py/mpz: Strip trailing zeros from mpz value when set from bytes.

This commit is contained in:
Damien George 2017-04-25 12:06:10 +10:00
parent 5e66f2b751
commit c7aa86ce6f

View File

@ -938,6 +938,8 @@ void mpz_set_from_bytes(mpz_t *z, bool big_endian, size_t len, const byte *buf)
#endif
num_bits -= DIG_SIZE;
}
z->len = mpn_remove_trailing_zeros(z->dig, z->dig + z->len);
}
bool mpz_is_zero(const mpz_t *z) {