diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-05-19 00:29:55 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-05-19 00:29:55 +0000 |
commit | 20a4c23bcc958cbc3ce9775b440d205ac0944db8 (patch) | |
tree | 0fe15e4d6828d6bbb3ad3b6a1d3b82e936f46cd5 /lib/Support/APInt.cpp | |
parent | f5135be3fc20534ccaee52cbfa80a8408af5672b (diff) |
Fix an assertion introduced by my last change to the toString method. We
can't use getZExtValue() to extract the low order bits for each digit.
Instead, we need to access the low order word directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37242 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r-- | lib/Support/APInt.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 49945d8497..267aaf81d4 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -1962,9 +1962,9 @@ std::string APInt::toString(uint8_t radix, bool wantSigned) const { uint64_t mask = radix - 1; APInt zero(tmp.getBitWidth(), 0); while (tmp.ne(zero)) { - unsigned digit = tmp.getZExtValue() & mask; - tmp = tmp.lshr(shift); + unsigned digit = (tmp.isSingleWord() ? tmp.VAL : tmp.pVal[0]) & mask; result.insert(insert_at, digits[digit]); + tmp = tmp.lshr(shift); } } return result; |