Skip to content
This repository was archived by the owner on Oct 28, 2023. It is now read-only.

Commit 8096b30

Browse files
authored
Merge pull request SHA2017-badge#190 from SHA2017-badge/basvs-fix-pack-8byte-bigendian
fix big-endian packing to 8 bytes
2 parents c8c014a + ca37a8d commit 8096b30

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

py/binary.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,12 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte **
303303
// zero/sign extend if needed
304304
if (BYTES_PER_WORD < 8 && size > sizeof(val)) {
305305
int c = (is_signed(val_type) && (mp_int_t)val < 0) ? 0xff : 0x00;
306-
memset(p + sizeof(val), c, size - sizeof(val));
306+
if (struct_type == '>') {
307+
memset(p, c, size - sizeof(val));
308+
p += size - sizeof(val);
309+
} else {
310+
memset(p + sizeof(val), c, size - sizeof(val));
311+
}
307312
}
308313
}
309314
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy