embutils.utils.bytes module
Byte manipulation utilities.
- date
2021
- author
Christian Wiche
- contact
- license
The MIT License (MIT)
- embutils.utils.bytes.bitmask(bit: int, fill: bool = False) int[source]
Returns a bitmask for the given bit length.
- Parameters
bit (int) – Bit length.
fill (bool) – If true, fill the mask with ones.
- Returns
bitmask.
- Return type
int
- embutils.utils.bytes.reverse_bits(value: int, size: Optional[int] = None) int[source]
Reverse the bits of the input value.
- Parameters
value (int) – Value to be reversed.
size (int) – Size of the input in bits. By default, it computes the minimum number of bits.
- Returns
Reversed value.
- Return type
int
- embutils.utils.bytes.reverse_bytes(value: int, size: Optional[int] = None) int[source]
Reverse the bytes of the input value.
- Parameters
value (int) – Value to be reversed.
size (int) – Size of the input in bytes. By default, it computes the minimum number of bytes.
- Returns
Reversed value.
- Return type
int