diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-02-21 05:44:56 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-02-21 05:44:56 +0000 |
commit | 60c0a6a74baf6750d87ab69f00c96f120cefa776 (patch) | |
tree | 6db0e09e97625c93d8d8b232f44d5dc6eb164bb9 /lib/Support/APInt.cpp | |
parent | f31c784f2774311d1f7194ac4ca86262197a8099 (diff) |
Fix the carry in addition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34465 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 27be51ce4d..ae7cc439d3 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -192,9 +192,9 @@ APInt& APInt::operator--() { static uint64_t add(uint64_t dest[], uint64_t x[], uint64_t y[], uint32_t len) { uint64_t carry = 0; for (uint32_t i = 0; i< len; ++i) { - uint64_t save = std::max(x[i],y[i]); dest[i] = x[i] + y[i] + carry; - carry = dest[i] < save ? 1 : 0; + uint64_t limit = std::min(x[i],y[i]); + carry = dest[i] < limit || (carry && dest[i] == limit); } return carry; } |