zserio.bitsizeof module¶
The module provides help methods to calculate size of nontrivial types.
- zserio.bitsizeof.bitsizeof_bitbuffer(bitbuffer: BitBuffer) int [source]¶
Gets the bit size of bit buffer which is stored in bit stream.
- Parameters:
bitbuffer – Bit buffer for calculation.
- Returns:
Length of bit buffer in bits.
- Raises:
PythonRuntimeException – Throws if given bit buffer is too long.
- zserio.bitsizeof.bitsizeof_bytes(value: bytearray) int [source]¶
Gets bit size of bytes.
- Parameters:
value – Bytes value to use for bit size calculation.
- Raises:
PythonRuntimeException – Throws if given string is too long.
- zserio.bitsizeof.bitsizeof_string(string: str) int [source]¶
Gets bit size of string.
- Parameters:
string – String value to use for bit size calculation.
- Raises:
PythonRuntimeException – Throws if given string is too long.
- zserio.bitsizeof.bitsizeof_varint(value: int) int [source]¶
Gets bit size of variable signed integer value (up to 9 bytes).
- Parameters:
value – Value to use for bit size calculation.
- Returns:
Bit size of the value.
- Raises:
PythonRuntimeException – Throws if given value is out of range for varint type.
- zserio.bitsizeof.bitsizeof_varint16(value: int) int [source]¶
Gets bit size of variable 16-bit signed integer value.
- Parameters:
value – Value to use for bit size calculation.
- Returns:
Bit size of the value.
- Raises:
PythonRuntimeException – Throws if given value is out of range for varint16 type.
- zserio.bitsizeof.bitsizeof_varint32(value: int) int [source]¶
Gets bit size of variable 32-bit signed integer value.
- Parameters:
value – Value to use for bit size calculation.
- Returns:
Bit size of the value.
- Raises:
PythonRuntimeException – Throws if given value is out of range for varint32 type.
- zserio.bitsizeof.bitsizeof_varint64(value: int) int [source]¶
Gets bit size of variable 64-bit signed integer value.
- Parameters:
value – Value to use for bit size calculation.
- Returns:
Bit size of the value.
- Raises:
PythonRuntimeException – Throws if given value is out of range for varint64 type.
- zserio.bitsizeof.bitsizeof_varsize(value: int) int [source]¶
Gets bit size of variable size integer value.
- Parameters:
value – Value to use for bit size calculation.
- Returns:
Bit size of the value.
- Raises:
PythonRuntimeException – Throws if given value is out of range for varsize type.
- zserio.bitsizeof.bitsizeof_varuint(value: int) int [source]¶
Gets bit size of variable unsigned integer value (up to 9 bytes).
- Parameters:
value – Value to use for bit size calculation.
- Returns:
Bit size of the value.
- Raises:
PythonRuntimeException – Throws if given value is out of range for varuint type.
- zserio.bitsizeof.bitsizeof_varuint16(value: int) int [source]¶
Gets bit size of variable 16-bit unsigned integer value.
- Parameters:
value – Value to use for bit size calculation.
- Returns:
Bit size of the value.
- Raises:
PythonRuntimeException – Throws if given value is out of range for varuint16 type.
- zserio.bitsizeof.bitsizeof_varuint32(value: int) int [source]¶
Gets bit size of variable 32-bit unsigned integer value.
- Parameters:
value – Value to use for bit size calculation.
- Returns:
Bit size of the value.
- Raises:
PythonRuntimeException – Throws if given value is out of range for varuint32 type.
- zserio.bitsizeof.bitsizeof_varuint64(value: int) int [source]¶
Gets bit size of variable 64-bit unsigned integer value.
- Parameters:
value – Value to use for bit size calculation.
- Returns:
Bit size of the value.
- Raises:
PythonRuntimeException – Throws if given value is out of range for varuint64 type.