mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-06 12:16:59 +00:00
add raw_ostream method for emitting an unsigned.
llvm-svn: 54972
This commit is contained in:
parent
84b8e5630e
commit
f155e446fd
@ -72,6 +72,23 @@ public:
|
||||
return write(Str, strlen(Str));
|
||||
}
|
||||
|
||||
raw_ostream &operator<<(unsigned N) {
|
||||
// Zero is a special case.
|
||||
if (N == 0)
|
||||
return *this << '0';
|
||||
|
||||
char NumberBuffer[20];
|
||||
char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
|
||||
char *CurPtr = EndPtr;
|
||||
|
||||
while (N) {
|
||||
*--CurPtr = '0' + char(N % 10);
|
||||
N /= 10;
|
||||
}
|
||||
return write(CurPtr, EndPtr-CurPtr);
|
||||
}
|
||||
|
||||
|
||||
raw_ostream &write(const char *Ptr, unsigned Size) {
|
||||
if (OutBufCur+Size > OutBufEnd)
|
||||
flush_impl();
|
||||
|
Loading…
x
Reference in New Issue
Block a user