mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-06 20:32:19 +00:00
utostr isn't going away too soon, try to make it slightly smaller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100977 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
16350f8d00
commit
b61e94fcf8
@ -57,15 +57,14 @@ static inline char *utohex_buffer(IntTy X, char *BufferEnd) {
|
||||
}
|
||||
|
||||
static inline std::string utohexstr(uint64_t X) {
|
||||
char Buffer[40];
|
||||
return utohex_buffer(X, Buffer+40);
|
||||
char Buffer[17];
|
||||
return utohex_buffer(X, Buffer+17);
|
||||
}
|
||||
|
||||
static inline std::string utostr_32(uint32_t X, bool isNeg = false) {
|
||||
char Buffer[20];
|
||||
char *BufPtr = Buffer+19;
|
||||
char Buffer[11];
|
||||
char *BufPtr = Buffer+11;
|
||||
|
||||
*BufPtr = 0; // Null terminate buffer...
|
||||
if (X == 0) *--BufPtr = '0'; // Handle special case...
|
||||
|
||||
while (X) {
|
||||
@ -75,17 +74,13 @@ static inline std::string utostr_32(uint32_t X, bool isNeg = false) {
|
||||
|
||||
if (isNeg) *--BufPtr = '-'; // Add negative sign...
|
||||
|
||||
return std::string(BufPtr);
|
||||
return std::string(BufPtr, Buffer+11);
|
||||
}
|
||||
|
||||
static inline std::string utostr(uint64_t X, bool isNeg = false) {
|
||||
if (X == uint32_t(X))
|
||||
return utostr_32(uint32_t(X), isNeg);
|
||||
char Buffer[21];
|
||||
char *BufPtr = Buffer+21;
|
||||
|
||||
char Buffer[40];
|
||||
char *BufPtr = Buffer+39;
|
||||
|
||||
*BufPtr = 0; // Null terminate buffer...
|
||||
if (X == 0) *--BufPtr = '0'; // Handle special case...
|
||||
|
||||
while (X) {
|
||||
@ -94,7 +89,7 @@ static inline std::string utostr(uint64_t X, bool isNeg = false) {
|
||||
}
|
||||
|
||||
if (isNeg) *--BufPtr = '-'; // Add negative sign...
|
||||
return std::string(BufPtr);
|
||||
return std::string(BufPtr, Buffer+21);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user