diff options
author | Damien George <damien@micropython.org> | 2020-11-05 22:42:28 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-11-11 22:18:24 +1100 |
commit | d7e1526593151b33ab52af445647c6d1315a96dc (patch) | |
tree | ac7239334e993a44ad280a7a712a2fc108f810ff /py | |
parent | bdfb584b294bf1379921b08ec020386b8ff6257b (diff) | |
download | micropython-d7e1526593151b33ab52af445647c6d1315a96dc.tar.gz micropython-d7e1526593151b33ab52af445647c6d1315a96dc.zip |
py/binary: Fix sign extension setting wide integer on 32-bit archs.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py')
-rw-r--r-- | py/binary.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/binary.c b/py/binary.c index d0f72ec23c..1847894b71 100644 --- a/py/binary.c +++ b/py/binary.c @@ -343,7 +343,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte *p val = mp_obj_get_int(val_in); // zero/sign extend if needed if (BYTES_PER_WORD < 8 && size > sizeof(val)) { - int c = (is_signed(val_type) && (mp_int_t)val < 0) ? 0xff : 0x00; + int c = (mp_int_t)val < 0 ? 0xff : 0x00; memset(p, c, size); if (struct_type == '>') { p += size - sizeof(val); |