llvm.org GIT mirror llvm / ff0b4a2
Use std::end instead of repeating buffer sizes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259312 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 4 years ago
2 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
7070
7171 static inline std::string utohexstr(uint64_t X, bool LowerCase = false) {
7272 char Buffer[17];
73 return utohex_buffer(X, Buffer+17, LowerCase);
73 return utohex_buffer(X, std::end(Buffer), LowerCase);
7474 }
7575
7676 static inline std::string utostr_32(uint32_t X, bool isNeg = false) {
7777 char Buffer[11];
78 char *BufPtr = Buffer+11;
78 char *BufPtr = std::end(Buffer);
7979
8080 if (X == 0) *--BufPtr = '0'; // Handle special case...
8181
8686
8787 if (isNeg) *--BufPtr = '-'; // Add negative sign...
8888
89 return std::string(BufPtr, Buffer+11);
89 return std::string(BufPtr, std::end(Buffer));
9090 }
9191
9292 static inline std::string utostr(uint64_t X, bool isNeg = false) {
9393 char Buffer[21];
94 char *BufPtr = Buffer+21;
94 char *BufPtr = std::end(Buffer);
9595
9696 if (X == 0) *--BufPtr = '0'; // Handle special case...
9797
101101 }
102102
103103 if (isNeg) *--BufPtr = '-'; // Add negative sign...
104 return std::string(BufPtr, Buffer+21);
104 return std::string(BufPtr, std::end(Buffer));
105105 }
106106
107107
140140 return this->operator<<(static_cast(N));
141141
142142 char NumberBuffer[20];
143 char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
143 char *EndPtr = std::end(NumberBuffer);
144144 char *CurPtr = EndPtr;
145145
146146 while (N) {
166166 return *this << '0';
167167
168168 char NumberBuffer[20];
169 char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
169 char *EndPtr = std::end(NumberBuffer);
170170 char *CurPtr = EndPtr;
171171
172172 while (N) {