
Only calcsize() and unpack() functions provided so far, for little-endian byte order. Format strings don't support repition spec (like "2b3i"). Unfortunately, dealing with all the various binary type sizes and alignments will lead to quite a bloated "binary" helper functions - if optimizing for speed. Need to think if using dynamic parametrized algos makes more sense.
4 lines
91 B
Python
4 lines
91 B
Python
import struct
|
|
print(struct.calcsize("<bI"))
|
|
print(struct.unpack("<bI", b"\x80\0\0\x01\0"))
|