Skip to content

kaitaiStructCompile/Endianness.py

Repository files navigation

Endianness.py Unlicensed work

PyPi Status GitLab Build Status GitLab Coverage wheel (GHA via nightly.link) GitHub Actions Coveralls Coverage Libraries.io Status Code style: antiflash

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.

Notation

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

Requirements