py/mpz: Normalize (remove leading zeros) xor operation result.

This commit is contained in:
Paul Sokolovsky 2015-11-22 22:03:18 +02:00
parent b56c635d64
commit b3be4710aa
1 changed files with 5 additions and 1 deletions

View File

@ -285,7 +285,11 @@ STATIC mp_uint_t mpn_xor(mpz_dig_t *idig, const mpz_dig_t *jdig, mp_uint_t jlen,
*idig = *jdig;
}
return idig - oidig;
// remove trailing zeros
for (--idig; idig >= oidig && *idig == 0; --idig) {
}
return idig + 1 - oidig;
}
/* computes i = i * d1 + d2