aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-15 00:05:03 +0000
committerChris Lattner <sabre@nondot.org>2001-10-15 00:05:03 +0000
commit6bb46cdf27cc7b6da13745d7391f697739558847 (patch)
tree76ccb5b52765d1cafb26e9b1b036a6496ce8e567
parentc5bdb247e4adc3eea9a89f34d76b92e363145e35 (diff)
downloadexternal_llvm-6bb46cdf27cc7b6da13745d7391f697739558847.zip
external_llvm-6bb46cdf27cc7b6da13745d7391f697739558847.tar.gz
external_llvm-6bb46cdf27cc7b6da13745d7391f697739558847.tar.bz2
Oops, didn't handle hex values correctly. :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@815 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/ConstPoolVals.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/VMCore/ConstPoolVals.cpp b/lib/VMCore/ConstPoolVals.cpp
index 25c58cb..3b543cb 100644
--- a/lib/VMCore/ConstPoolVals.cpp
+++ b/lib/VMCore/ConstPoolVals.cpp
@@ -168,7 +168,7 @@ string ConstPoolArray::getStrValue() const {
//
const Type *ETy = cast<ArrayType>(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<ConstPoolSInt>(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<ConstPoolSInt>(Operands[i])->getValue() :
(unsigned char)cast<ConstPoolUInt>(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 += "\"";