1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Add slow path for single character write, and use exclusively for

single characters writes outside of the fast path in raw_ostream.h

llvm-svn: 67053
This commit is contained in:
Daniel Dunbar 2009-03-16 22:00:17 +00:00
parent 5f2d01236e
commit c64fdabf4f
2 changed files with 12 additions and 11 deletions

View File

@ -82,7 +82,7 @@ public:
raw_ostream &operator<<(char C) {
if (OutBufCur >= OutBufEnd)
flush_impl();
return write(C);
*OutBufCur++ = C;
if (Unbuffered)
flush_impl();
@ -91,7 +91,7 @@ public:
raw_ostream &operator<<(unsigned char C) {
if (OutBufCur >= OutBufEnd)
flush_impl();
return write(C);
*OutBufCur++ = C;
if (Unbuffered)
flush_impl();
@ -100,7 +100,7 @@ public:
raw_ostream &operator<<(signed char C) {
if (OutBufCur >= OutBufEnd)
flush_impl();
return write(C);
*OutBufCur++ = C;
if (Unbuffered)
flush_impl();
@ -132,6 +132,7 @@ public:
return this->operator<<(ftostr(N));
}
raw_ostream &write(unsigned char C);
raw_ostream &write(const char *Ptr, unsigned Size);
// Formatted output, see the format() function in Support/Format.h.

View File

@ -63,10 +63,7 @@ raw_ostream &raw_ostream::operator<<(unsigned long N) {
raw_ostream &raw_ostream::operator<<(long N) {
if (N < 0) {
if (OutBufCur >= OutBufEnd)
flush_impl();
*OutBufCur++ = '-';
*this << '-';
N = -N;
}
@ -91,10 +88,7 @@ raw_ostream &raw_ostream::operator<<(unsigned long long N) {
raw_ostream &raw_ostream::operator<<(long long N) {
if (N < 0) {
if (OutBufCur >= OutBufEnd)
flush_impl();
*OutBufCur++ = '-';
*this << '-';
N = -N;
}
@ -106,6 +100,12 @@ raw_ostream &raw_ostream::operator<<(const void *P) {
return *this << format("%p", P);
}
raw_ostream &raw_ostream::write(unsigned char C) {
if (OutBufCur >= OutBufEnd)
flush_impl();
*OutBufCur++ = C;
}
raw_ostream &raw_ostream::write(const char *Ptr, unsigned Size) {
if (OutBufCur+Size > OutBufEnd)