diff options
author | Damien George <damien.p.george@gmail.com> | 2015-04-25 23:16:39 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-04-25 23:16:39 +0100 |
commit | 271d18eb08ec488ee45f8e6cd852e8236074f082 (patch) | |
tree | f5ba5d1b28cb48e72334fb079a5d6ef148083970 /py/mpz.h | |
parent | 7c8b4c1a8b8278d864649c127857e34a6bd29504 (diff) |
py: Support conversion of bignum to bytes.
This gets int.to_bytes working for bignum, and also struct.pack with 'q'
and 'Q' args on 32-bit machines.
Addresses issue #1155.
Diffstat (limited to 'py/mpz.h')
-rw-r--r-- | py/mpz.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -125,6 +125,7 @@ void mpz_divmod_inpl(mpz_t *dest_quo, mpz_t *dest_rem, const mpz_t *lhs, const m mp_int_t mpz_hash(const mpz_t *z); bool mpz_as_int_checked(const mpz_t *z, mp_int_t *value); bool mpz_as_uint_checked(const mpz_t *z, mp_uint_t *value); +void mpz_as_bytes(const mpz_t *z, bool big_endian, mp_uint_t len, byte *buf); #if MICROPY_PY_BUILTINS_FLOAT mp_float_t mpz_as_float(const mpz_t *z); #endif |