diff options
author | Damien George <damien.p.george@gmail.com> | 2014-09-10 22:10:33 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-09-10 22:10:33 +0100 |
commit | 953074315e594f5a30f455dc6a1a67340a3e6ea7 (patch) | |
tree | 9bce234da3c55224ee5cb6edd9cfd830be3e7960 /py/objint_mpz.c | |
parent | 6eae861685e8860e7542097ad20f69168e639a93 (diff) | |
download | micropython-953074315e594f5a30f455dc6a1a67340a3e6ea7.tar.gz micropython-953074315e594f5a30f455dc6a1a67340a3e6ea7.zip |
py: Enable struct/binary-helper to parse q and Q sized ints.
Addresses issue #848.
Diffstat (limited to 'py/objint_mpz.c')
-rw-r--r-- | py/objint_mpz.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/py/objint_mpz.c b/py/objint_mpz.c index 440b4f3187..39806bb277 100644 --- a/py/objint_mpz.c +++ b/py/objint_mpz.c @@ -279,7 +279,13 @@ mp_obj_t mp_obj_new_int(mp_int_t value) { mp_obj_t mp_obj_new_int_from_ll(long long val) { mp_obj_int_t *o = mp_obj_int_new_mpz(); - mpz_set_from_ll(&o->mpz, val); + mpz_set_from_ll(&o->mpz, val, true); + return o; +} + +mp_obj_t mp_obj_new_int_from_ull(unsigned long long val) { + mp_obj_int_t *o = mp_obj_int_new_mpz(); + mpz_set_from_ll(&o->mpz, val, false); return o; } |