zserio.bitfield module

The module provides help methods for bit fields calculation.

zserio.bitfield.bitfield_lowerbound(length: int) int[source]

Gets the lower bound of a unsigned bitfield type with given length.

Parameters:

length – Length of the unsigned bitfield in bits.

Returns:

The lowest value the unsigned bitfield can hold.

Raises:

PythonRuntimeException – If unsigned bitfield with wrong length has been specified.

zserio.bitfield.bitfield_upperbound(length: int) int[source]

Gets the upper bound of a unsigned bitfield type with given length.

Parameters:

length – Length of the unsigned bitfield in bits.

Returns:

The largest value the unsigned bitfield can hold.

Raises:

PythonRuntimeException – If unsigned bitfield with wrong length has been specified.

zserio.bitfield.signed_bitfield_lowerbound(length: int) int[source]

Gets the lower bound of a signed bitfield type with given length.

Parameters:

length – Length of the signed bitfield in bits.

Returns:

The lowest value the signed bitfield can hold.

Raises:

PythonRuntimeException – If signed bitfield with wrong length has been specified.

zserio.bitfield.signed_bitfield_upperbound(length: int) int[source]

Gets the upper bound of a signed bitfield type with given length.

Parameters:

length – Length of the signed bitfield in bits.

Returns:

The largest value the signed bitfield can hold.

Raises:

PythonRuntimeException – If signed bitfield with wrong length has been specified.