diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-11-27 13:19:46 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-11-27 13:19:46 +0000 |
commit | 4aeb48904344d2dd8e3b8f39a4752567828ad96f (patch) | |
tree | 7226a584f0f378dd416724cf85589c204e7fb6ff /include/llvm/ADT/StringExtras.h | |
parent | d420e7b76cefb350a9cb89f1fb417f3f42636e30 (diff) | |
download | llvm-4aeb48904344d2dd8e3b8f39a4752567828ad96f.tar.gz llvm-4aeb48904344d2dd8e3b8f39a4752567828ad96f.tar.bz2 llvm-4aeb48904344d2dd8e3b8f39a4752567828ad96f.tar.xz |
Add an optional LowerCase argument to hexdigit().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/StringExtras.h')
-rw-r--r-- | include/llvm/ADT/StringExtras.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/llvm/ADT/StringExtras.h b/include/llvm/ADT/StringExtras.h index 3c53adee63..263723294a 100644 --- a/include/llvm/ADT/StringExtras.h +++ b/include/llvm/ADT/StringExtras.h @@ -25,10 +25,11 @@ namespace llvm { template<typename T> class SmallVectorImpl; -/// hexdigit - Return the (uppercase) hexadecimal character for the +/// hexdigit - Return the hexadecimal character for the /// given number \arg X (which should be less than 16). -static inline char hexdigit(unsigned X) { - return X < 10 ? '0' + X : 'A' + X - 10; +static inline char hexdigit(unsigned X, bool LowerCase = false) { + const char HexChar = LowerCase ? 'a' : 'A'; + return X < 10 ? '0' + X : HexChar + X - 10; } /// utohex_buffer - Emit the specified number into the buffer specified by |