From 74cb271d2b597dbd0d67aeb817a8d9f9b34dfaa6 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 14 Jul 2014 21:56:54 +0000 Subject: [PATCH] ADT: Surface LowerCase argument for utohexstr The underlying function. utohex_buffer, already supports an argument for deciding if the hex characters should be upper or lower case. Expose an identical argument for utohexstr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212991 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/StringExtras.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/llvm/ADT/StringExtras.h b/include/llvm/ADT/StringExtras.h index a152f4d3c2a..0992f5d4a54 100644 --- a/include/llvm/ADT/StringExtras.h +++ b/include/llvm/ADT/StringExtras.h @@ -53,7 +53,7 @@ static inline unsigned hexDigitValue(char C) { /// This should only be used with unsigned types. /// template -static inline char *utohex_buffer(IntTy X, char *BufferEnd) { +static inline char *utohex_buffer(IntTy X, char *BufferEnd, bool LowerCase = false) { char *BufPtr = BufferEnd; *--BufPtr = 0; // Null terminate buffer. if (X == 0) { @@ -63,15 +63,15 @@ static inline char *utohex_buffer(IntTy X, char *BufferEnd) { while (X) { unsigned char Mod = static_cast(X) & 15; - *--BufPtr = hexdigit(Mod); + *--BufPtr = hexdigit(Mod, LowerCase); X >>= 4; } return BufPtr; } -static inline std::string utohexstr(uint64_t X) { +static inline std::string utohexstr(uint64_t X, bool LowerCase = false) { char Buffer[17]; - return utohex_buffer(X, Buffer+17); + return utohex_buffer(X, Buffer+17, LowerCase); } static inline std::string utostr_32(uint32_t X, bool isNeg = false) { -- 2.34.1