summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Support/raw_ostream.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 592cb96e894..f5a3162e2ba 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -420,11 +420,10 @@ raw_ostream &raw_ostream::operator<<(const FormattedNumber &FN) {
NumberBuffer[1] = '0';
char *EndPtr = NumberBuffer+Width;
char *CurPtr = EndPtr;
- const char A = FN.Upper ? 'A' : 'a';
unsigned long long N = FN.HexValue;
while (N) {
- uintptr_t x = N % 16;
- *--CurPtr = (x < 10 ? '0' + x : A + x - 10);
+ unsigned char x = static_cast<unsigned char>(N) % 16;
+ *--CurPtr = hexdigit(x, !FN.Upper);
N /= 16;
}
OpenPOWER on IntegriCloud