mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-07 13:16:36 +02:00
A followup patch for bignum addition carrying from Lorenzo.
This commit is contained in:
parent
df116bb779
commit
1012f7e129
1 changed files with 1 additions and 1 deletions
2
bignum.c
2
bignum.c
|
@ -341,7 +341,7 @@ sexp sexp_bignum_add_digits (sexp ctx, sexp dst, sexp a, sexp b) {
|
||||||
for (i=0; i<blen; i++) {
|
for (i=0; i<blen; i++) {
|
||||||
n = adata[i];
|
n = adata[i];
|
||||||
cdata[i] = n + bdata[i] + carry;
|
cdata[i] = n + bdata[i] + carry;
|
||||||
carry = (n > (SEXP_UINT_T_MAX - bdata[i]) ? 1 : 0);
|
carry = (n > (SEXP_UINT_T_MAX - bdata[i] - carry) ? 1 : 0);
|
||||||
}
|
}
|
||||||
for ( ; carry && (i<alen); i++) {
|
for ( ; carry && (i<alen); i++) {
|
||||||
carry = (cdata[i] == SEXP_UINT_T_MAX ? 1 : 0);
|
carry = (cdata[i] == SEXP_UINT_T_MAX ? 1 : 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue