py: Fix bug in mpz_and function.

Addresses issue #610.
This commit is contained in:
Damien George 2014-05-12 23:27:29 +01:00
parent cc97446ca5
commit 561e425903
2 changed files with 10 additions and 2 deletions

View File

@ -213,8 +213,8 @@ STATIC uint mpn_and(mpz_dig_t *idig, const mpz_dig_t *jdig, uint jlen, const mpz
*idig = *jdig & *kdig;
}
for (; jlen > 0; --jlen, ++idig) {
*idig = 0;
// remove trailing zeros
for (; idig > oidig && *idig == 0; --idig) {
}
return idig - oidig;

View File

@ -0,0 +1,8 @@
print(0 & (1 << 80))
print(0 & (1 << 80) == 0)
print(bool(0 & (1 << 80)))
#a = 0xfffffffffffffffffffffffffffff
#print(a & (1 << 80))
#print((a & (1 << 80)) >> 80)
#print((a & (1 << 80)) >> 80 == 1)