[llvm] r260068 - [Support] Use hexdigit. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 7 17:03:01 PST 2016
Author: ctopper
Date: Sun Feb 7 19:03:01 2016
New Revision: 260068
URL: http://llvm.org/viewvc/llvm-project?rev=260068&view=rev
Log:
[Support] Use hexdigit. NFC
Modified:
llvm/trunk/lib/Support/raw_ostream.cpp
Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=260068&r1=260067&r2=260068&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Sun Feb 7 19:03:01 2016
@@ -420,11 +420,10 @@ raw_ostream &raw_ostream::operator<<(con
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;
}
More information about the llvm-commits
mailing list