py/mpz: Strip trailing zeros from mpz value when set from bytes.
This commit is contained in:
parent
5e66f2b751
commit
c7aa86ce6f
2
py/mpz.c
2
py/mpz.c
@ -938,6 +938,8 @@ void mpz_set_from_bytes(mpz_t *z, bool big_endian, size_t len, const byte *buf)
|
|||||||
#endif
|
#endif
|
||||||
num_bits -= DIG_SIZE;
|
num_bits -= DIG_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
z->len = mpn_remove_trailing_zeros(z->dig, z->dig + z->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mpz_is_zero(const mpz_t *z) {
|
bool mpz_is_zero(const mpz_t *z) {
|
||||||
|
Loading…
Reference in New Issue
Block a user