py/mpz: Fix bignum anding of large negative with smaller positive int.

This commit is contained in:
Damien George
2015-10-01 22:35:06 +01:00
parent a81539db25
commit 2065373f67
2 changed files with 4 additions and 6 deletions

View File

@@ -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;