mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-30 17:33:24 +00:00
Fix the carry in addition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34465 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f31c784f27
commit
60c0a6a74b
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user