This is a library to compute ranges mapping of endiannesses. The library allows you to map (a) slice(s) of bits of a number of a certain length in provided generalized endianness to a slices of bits of a number.
It is not yet ready.
An endianness is encoded as
((?P<type>b|l)(?P<chunk_size_in_bits>\d+))+
Examples
The examples of number 0x0123456789ABCDEF encoded in different endianneses:
b32 or b16 or b8 or b4 or b32_b16_b8_b4_b2 (also known as just "big endian")
0123456789ABCDEF
l32 or l32_b32 or l32_b8
89ABCDEF 01234567
l32_b16_l8
AB/89|EF/CD 23/01|67/45
l16
CDEF 89AB 4567 0123
l8 (also known as just "little endian")
EF CD AB 89 67 45 23 01
l4
F E D C B A 9 8 7 6 5 4 3 2 1 0
Python >=3.4.Python 2is dead, stop raping its corpse. Use2to3with manual postprocessing to migrate incompatible code to3. It shouldn't take so much time. For unit-testing you need Python 3.6+ or PyPy3 because theirdictis ordered and deterministic.rangeslicetools
wheel (GHA via
nightly.link)