aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-02-22 00:58:45 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-02-22 00:58:45 +0000
commit15aab8a723f9a316fe387af22a21b2a3abbaa066 (patch)
tree32be947bf2f4bc7ab2aa113f9a043e59a41aa9d2 /lib/Support/APInt.cpp
parentab2b2c827c4a60e558efaea3bfeb1ebd13b5985b (diff)
When converting from 64 to 32-bits, use the actual number of words to
extract the value, not the number of words implied by the active bits. This fixes numerous, but not all divide bugs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34484 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r--lib/Support/APInt.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp
index c8ab2d762b..03652a8f89 100644
--- a/lib/Support/APInt.cpp
+++ b/lib/Support/APInt.cpp
@@ -1177,7 +1177,7 @@ void APInt::divide(const APInt LHS, uint32_t lhsWords,
uint32_t *U = new uint32_t[m + n + 1];
memset(U, 0, (m+n+1)*sizeof(uint32_t));
for (unsigned i = 0; i < lhsWords; ++i) {
- uint64_t tmp = (lhsWords == 1 ? LHS.VAL : LHS.pVal[i]);
+ uint64_t tmp = (LHS.getNumWords() == 1 ? LHS.VAL : LHS.pVal[i]);
U[i * 2] = tmp & mask;
U[i * 2 + 1] = tmp >> (sizeof(uint32_t)*8);
}
@@ -1186,7 +1186,7 @@ void APInt::divide(const APInt LHS, uint32_t lhsWords,
uint32_t *V = new uint32_t[n];
memset(V, 0, (n)*sizeof(uint32_t));
for (unsigned i = 0; i < rhsWords; ++i) {
- uint64_t tmp = (rhsWords == 1 ? RHS.VAL : RHS.pVal[i]);
+ uint64_t tmp = (RHS.getNumWords() == 1 ? RHS.VAL : RHS.pVal[i]);
V[i * 2] = tmp & mask;
V[i * 2 + 1] = tmp >> (sizeof(uint32_t)*8);
}