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
/// This should only be used with unsigned types.
///
template<typename IntTy>
/// This should only be used with unsigned types.
///
template<typename IntTy>
-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) {
char *BufPtr = BufferEnd;
*--BufPtr = 0; // Null terminate buffer.
if (X == 0) {
while (X) {
unsigned char Mod = static_cast<unsigned char>(X) & 15;
while (X) {
unsigned char Mod = static_cast<unsigned char>(X) & 15;
- *--BufPtr = hexdigit(Mod);
+ *--BufPtr = hexdigit(Mod, LowerCase);
X >>= 4;
}
return BufPtr;
}
X >>= 4;
}
return BufPtr;
}
-static inline std::string utohexstr(uint64_t X) {
+static inline std::string utohexstr(uint64_t X, bool LowerCase = false) {
- 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) {
}
static inline std::string utostr_32(uint32_t X, bool isNeg = false) {