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 | db2abec8acead1c26d03ca07d19b42244170270a (patch) | |
tree | ddb4786c39b7c19fac19e2eabb5d14470be073af /llvm/lib/Support/APInt.cpp | |
parent | 4f44f5e8ac59a3ab8e52d7d8e8b85652bf090f12 (diff) | |
download | bcm5719-llvm-db2abec8acead1c26d03ca07d19b42244170270a.tar.gz bcm5719-llvm-db2abec8acead1c26d03ca07d19b42244170270a.zip |
Fix the carry in addition.
llvm-svn: 34465
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 27be51ce4d9..ae7cc439d3d 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/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; } |