Commit c7aa86ce authored by Damien George's avatar Damien George
Browse files

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

parent 5e66f2b7
...@@ -938,6 +938,8 @@ void mpz_set_from_bytes(mpz_t *z, bool big_endian, size_t len, const byte *buf) ...@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment