diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-02-22 00:58:45 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-02-22 00:58:45 +0000 |
commit | 867b4064ae777773707dc8970e7b80ea9767ea1e (patch) | |
tree | 8a876b6e72de52792662400ca5dcb46ea0f2d01c /llvm/lib/Support/APInt.cpp | |
parent | e4ce71d07aa1731d6c87bd43cc6440f724a21486 (diff) | |
download | bcm5719-llvm-867b4064ae777773707dc8970e7b80ea9767ea1e.tar.gz bcm5719-llvm-867b4064ae777773707dc8970e7b80ea9767ea1e.zip |
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.
llvm-svn: 34484
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index c8ab2d762b6..03652a8f893 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/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); } |