summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-10-01 22:35:06 +0100
committerDamien George <damien.p.george@gmail.com>2015-10-01 22:35:06 +0100
commit2065373f67b126edfc3e0f2519aaad0956902c14 (patch)
treeecfd697b35b0bc1c883b845c1be625578deafc8f /py
parenta81539db25d443826e5247fefda8ae73bad64056 (diff)
downloadmicropython-2065373f67b126edfc3e0f2519aaad0956902c14.tar.gz
micropython-2065373f67b126edfc3e0f2519aaad0956902c14.zip
py/mpz: Fix bignum anding of large negative with smaller positive int.
Diffstat (limited to 'py')
-rw-r--r--py/mpz.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/py/mpz.c b/py/mpz.c
index 166fa7adbe..e0475d60a1 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -239,12 +239,8 @@ STATIC mp_uint_t mpn_and_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, mp_uint_t j
carry >>= DIG_SIZE;
}
- if (carry != 0) {
- *idig = carry;
- } else {
- // remove trailing zeros
- for (--idig; idig >= oidig && *idig == 0; --idig) {
- }
+ // remove trailing zeros
+ for (--idig; idig >= oidig && *idig == 0; --idig) {
}
return idig + 1 - oidig;