summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/ADT/StringExtras.h10
-rw-r--r--llvm/lib/Support/raw_ostream.cpp4
2 files changed, 7 insertions, 7 deletions
diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h
index 0992f5d4a54..2366e67f2d7 100644
--- a/llvm/include/llvm/ADT/StringExtras.h
+++ b/llvm/include/llvm/ADT/StringExtras.h
@@ -71,12 +71,12 @@ static inline char *utohex_buffer(IntTy X, char *BufferEnd, bool LowerCase = fal
static inline std::string utohexstr(uint64_t X, bool LowerCase = false) {
char Buffer[17];
- return utohex_buffer(X, Buffer+17, LowerCase);
+ return utohex_buffer(X, std::end(Buffer), LowerCase);
}
static inline std::string utostr_32(uint32_t X, bool isNeg = false) {
char Buffer[11];
- char *BufPtr = Buffer+11;
+ char *BufPtr = std::end(Buffer);
if (X == 0) *--BufPtr = '0'; // Handle special case...
@@ -87,12 +87,12 @@ static inline std::string utostr_32(uint32_t X, bool isNeg = false) {
if (isNeg) *--BufPtr = '-'; // Add negative sign...
- return std::string(BufPtr, Buffer+11);
+ return std::string(BufPtr, std::end(Buffer));
}
static inline std::string utostr(uint64_t X, bool isNeg = false) {
char Buffer[21];
- char *BufPtr = Buffer+21;
+ char *BufPtr = std::end(Buffer);
if (X == 0) *--BufPtr = '0'; // Handle special case...
@@ -102,7 +102,7 @@ static inline std::string utostr(uint64_t X, bool isNeg = false) {
}
if (isNeg) *--BufPtr = '-'; // Add negative sign...
- return std::string(BufPtr, Buffer+21);
+ return std::string(BufPtr, std::end(Buffer));
}
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 15813fd3e66..a278a3b4660 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -141,7 +141,7 @@ raw_ostream &raw_ostream::operator<<(unsigned long long N) {
return this->operator<<(static_cast<unsigned long>(N));
char NumberBuffer[20];
- char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
+ char *EndPtr = std::end(NumberBuffer);
char *CurPtr = EndPtr;
while (N) {
@@ -167,7 +167,7 @@ raw_ostream &raw_ostream::write_hex(unsigned long long N) {
return *this << '0';
char NumberBuffer[20];
- char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
+ char *EndPtr = std::end(NumberBuffer);
char *CurPtr = EndPtr;
while (N) {
OpenPOWER on IntegriCloud