explain use of byte-order sigil
This commit is contained in:
parent
42b1fbaeba
commit
b349ecbf69
|
@ -7,6 +7,8 @@ def body_and_tail(data):
|
|||
nblocks = l // 16
|
||||
tail = l % 16
|
||||
if nblocks:
|
||||
# we use '<', specifying little-endian byte order for data bigger than
|
||||
# a byte so behavior is the same on little- and big-endian platforms
|
||||
return struct.unpack_from('<' + ('qq' * nblocks), data), struct.unpack_from('b' * tail, data, -tail), l
|
||||
else:
|
||||
return tuple(), struct.unpack_from('b' * tail, data, -tail), l
|
||||
|
|
Loading…
Reference in New Issue