From 6bb46cdf27cc7b6da13745d7391f697739558847 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 15 Oct 2001 00:05:03 +0000 Subject: [PATCH] Oops, didn't handle hex values correctly. :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@815 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/ConstPoolVals.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/VMCore/ConstPoolVals.cpp b/lib/VMCore/ConstPoolVals.cpp index 25c58cbd65b..3b543cbcbe5 100644 --- a/lib/VMCore/ConstPoolVals.cpp +++ b/lib/VMCore/ConstPoolVals.cpp @@ -168,7 +168,7 @@ string ConstPoolArray::getStrValue() const { // const Type *ETy = cast(getType())->getElementType(); bool isString = (ETy == Type::SByteTy || ETy == Type::UByteTy); - for (unsigned i = 0; i < Operands.size(); i++) + for (unsigned i = 0; i < Operands.size(); ++i) if (ETy == Type::SByteTy && cast(Operands[i])->getValue() < 0) { isString = false; @@ -177,7 +177,7 @@ string ConstPoolArray::getStrValue() const { if (isString) { Result = "c\""; - for (unsigned i = 0; i < Operands.size(); i++) { + for (unsigned i = 0; i < Operands.size(); ++i) { unsigned char C = (ETy == Type::SByteTy) ? (unsigned char)cast(Operands[i])->getValue() : (unsigned char)cast(Operands[i])->getValue(); @@ -186,8 +186,8 @@ string ConstPoolArray::getStrValue() const { Result += C; } else { Result += '\\'; - Result += (C/16)+'0'; - Result += (C&15)+'0'; + Result += ( C/16 < 10) ? ( C/16 +'0') : ( C/16 -10+'A'); + Result += ((C&15) < 10) ? ((C&15)+'0') : ((C&15)-10+'A'); } } Result += "\"";