Enums#

class Endianness#
Big = Endianness.Big#
Little = Endianness.Little#
Unspecified = Endianness.Unspecified#

This specifies the byte order to use when creating or interpreting some whole-byte values.

The default is generally Endianness.Unspecified which means that values are considered bit-wise big-endian. This is equivalent to Endianness.Big for whole-byte values, but can be used for any length.

Floats and integer values can be constructed and interpreted as big- or little-endian by using the appropriate enum value with from_ and to_ methods, for example see Tibs.from_f() and Mutibs.to_u(). The Tibs.le and Tibs.be view properties are usually the most convenient way to interpret an existing value.


class BitOrder#
Lsb0 = BitOrder.Lsb0#
Msb0 = BitOrder.Msb0#

This specifies how bit labels are mapped inside each byte when using View.

BitOrder.Msb0 is the default convention: within each byte, label 0 refers to the most significant bit. This matches normal Tibs indexing and slicing.

BitOrder.Lsb0 is common in hardware manuals and protocol specifications: within each byte, label 0 refers to the least significant bit. Use the Tibs.lsb0 view property when a specification uses this numbering.

Bit order is about labels, not about the stored data changing. For a longer introduction and examples of field extraction, see Views.


class DtypeKind#
Bin = DtypeKind.Bin#
Bytes = DtypeKind.Bytes#
Float = DtypeKind.Float#
Hex = DtypeKind.Hex#
Int = DtypeKind.Int#
Oct = DtypeKind.Oct#
Uint = DtypeKind.Uint#

Each Dtype instance has a ‘kind’ which controls how to create and interpret values. For example Codec.Float is used for floating point data types.

Unless you are creating or dealing with data types programmatically, you probably won’t need to use this enum directly.


class Codec#
Auto = Codec.Auto#
Raw = Codec.Raw#
Rice = Codec.Rice#
Zstd = Codec.Zstd#

Different encoding strategies can be specified when using Tibs.encode(). Usually the default Codec.Auto should be used. It uses compact inline forms for short sequences and tries to pick a small representation for longer sequences.

Codec.Raw stores the bits directly with length metadata. Codec.Rice is intended for sparse data, where one bit value occurs much less often than the other. Codec.Zstd uses Zstandard compression and is often better for larger byte-like data.

The encoded byte format stores enough length information to decode one value exactly. See Byte encoding format for the format details.