explain use of byte-order sigil

This commit is contained in:
Jim Witschey 2017-07-12 10:24:03 -04:00
parent 42b1fbaeba
commit b349ecbf69
1 changed files with 2 additions and 0 deletions

View File

@ -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