[llvm] r259762 - [Support] Use hexdigit instead of manually coding the same thing. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 22:51:39 PST 2016


Author: ctopper
Date: Thu Feb  4 00:51:38 2016
New Revision: 259762

URL: http://llvm.org/viewvc/llvm-project?rev=259762&view=rev
Log:
[Support] Use hexdigit instead of manually coding the same thing. 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=259762&r1=259761&r2=259762&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Thu Feb  4 00:51:38 2016
@@ -171,8 +171,8 @@ raw_ostream &raw_ostream::write_hex(unsi
   char *CurPtr = EndPtr;
 
   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, /*LowerCase*/true);
     N /= 16;
   }
 




More information about the llvm-commits mailing list