diff options
Diffstat (limited to 'py')
-rw-r--r-- | py/binary.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/py/binary.c b/py/binary.c index e38aae8ea3..870a0942ba 100644 --- a/py/binary.c +++ b/py/binary.c @@ -303,7 +303,10 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte ** // 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; - memset(p + sizeof(val), c, size - sizeof(val)); + memset(p, c, size); + if (struct_type == '>') { + p += size - sizeof(val); + } } } } |