summaryrefslogtreecommitdiff
path: root/py/binary.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/binary.c')
-rw-r--r--py/binary.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/py/binary.c b/py/binary.c
index 83f28db91..a8907bfbf 100644
--- a/py/binary.c
+++ b/py/binary.c
@@ -297,19 +297,19 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte *p
if (mp_obj_is_type(val_in, &mp_type_int)) {
mp_obj_int_to_bytes_impl(val_in, struct_type == '>', size, p);
return;
- } else
+ }
#endif
- {
- 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;
- memset(p, c, size);
- if (struct_type == '>') {
- p += size - sizeof(val);
- }
+
+ 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;
+ memset(p, c, size);
+ if (struct_type == '>') {
+ p += size - sizeof(val);
}
}
+ break;
}
mp_binary_set_int(MIN((size_t)size, sizeof(val)), struct_type == '>', p, val);