Add an optional LowerCase argument to hexdigit().

llvm-svn: 120213
This commit is contained in:
Daniel Dunbar 2010-11-27 13:19:46 +00:00
parent f80507c28c
commit f9c900d3c9
1 changed files with 4 additions and 3 deletions

View File

@ -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