summaryrefslogtreecommitdiff
path: root/py/objint.c
diff options
context:
space:
mode:
authorGlenn Ruben Bakke <glennbakke@gmail.com>2017-02-07 22:27:32 +0100
committerGlenn Ruben Bakke <glennbakke@gmail.com>2017-02-07 22:27:32 +0100
commit122d0430db4d103dfb8bc9958b7df4d9803038c8 (patch)
tree856ac0d4950b0154cc6aae8cf022fd29b2402073 /py/objint.c
parent723943abde3e9de5e14ee40df5e0d5fe25352c97 (diff)
parent4cf7fd151e98a3d842eb5c9428545cb67ddd57ee (diff)
Merge branch 'nrf52' into nrf5_no_sdk
Diffstat (limited to 'py/objint.c')
-rw-r--r--py/objint.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objint.c b/py/objint.c
index a61ed8e27..222aa1de7 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -383,7 +383,7 @@ STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) {
#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
// If result guaranteedly fits in small int, use that
- if (!MP_SMALL_INT_FITS(1 << (bufinfo.len * 8 - 1))) {
+ if (bufinfo.len >= sizeof(mp_uint_t) || !MP_SMALL_INT_FITS(1 << (bufinfo.len * 8 - 1))) {
return mp_obj_int_from_bytes_impl(args[2] != MP_OBJ_NEW_QSTR(MP_QSTR_little), bufinfo.len, bufinfo.buf);
} else
#endif