llvm.org GIT mirror llvm / 921be7a
Remove SmallString::append_*int* methods; how many copies of int -> str conversion code do we really need? - S.append_uint(N) can be replaced with 'raw_svector_ostream(S) << N' which is somewhat slower due to the extra set up cost, but still plenty fast (especially if the svector set up cost can be amortized). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79450 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 11 years ago
1 changed file(s) with 0 addition(s) and 41 deletion(s). Raw diff Collapse all Expand all
5858 this->push_back(C);
5959 return *this;
6060 }
61
62 SmallString &append_uint_32(uint32_t N) {
63 char Buffer[20];
64 char *BufPtr = Buffer+20;
65
66 if (N == 0) *--BufPtr = '0'; // Handle special case.
67
68 while (N) {
69 *--BufPtr = '0' + char(N % 10);
70 N /= 10;
71 }
72 this->append(BufPtr, Buffer+20);
73 return *this;
74 }
75
76 SmallString &append_uint(uint64_t N) {
77 if (N == uint32_t(N))
78 return append_uint_32(uint32_t(N));
79
80 char Buffer[40];
81 char *BufPtr = Buffer+40;
82
83 if (N == 0) *--BufPtr = '0'; // Handle special case...
84
85 while (N) {
86 *--BufPtr = '0' + char(N % 10);
87 N /= 10;
88 }
89
90 this->append(BufPtr, Buffer+40);
91 return *this;
92 }
93
94 SmallString &append_sint(int64_t N) {
95 if (N < 0) {
96 this->push_back('-');
97 N = -N;
98 }
99 return append_uint((uint64_t)N);
100 }
101
10261 };
10362
10463