[llvm] r212991 - ADT: Surface LowerCase argument for utohexstr
David Majnemer
david.majnemer at gmail.com
Mon Jul 14 14:56:54 PDT 2014
Author: majnemer
Date: Mon Jul 14 16:56:54 2014
New Revision: 212991
URL: http://llvm.org/viewvc/llvm-project?rev=212991&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/ADT/StringExtras.h
Modified: llvm/trunk/include/llvm/ADT/StringExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringExtras.h?rev=212991&r1=212990&r2=212991&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/StringExtras.h Mon Jul 14 16:56:54 2014
@@ -53,7 +53,7 @@ static inline unsigned hexDigitValue(cha
/// 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) {
@@ -63,15 +63,15 @@ static inline char *utohex_buffer(IntTy
while (X) {
unsigned char Mod = static_cast<unsigned char>(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) {
More information about the llvm-commits
mailing list