mrcrowbar.bits module¶
- class mrcrowbar.bits.BitStream(buffer=None, start_offset=None, bytes_reverse=False, bit_endian='big', io_endian='big')[source]¶
Bases:
object
Create a BitStream instance.
- buffer
Target byte array to read/write from. Defaults to an empty array.
- start_offset
Position in the target to start reading from. Can be an integer byte offset, or a tuple containing the byte and bit offsets. Defaults to the start of the stream, depending on the endianness and ordering options.
- bytes_reverse
If enabled, fetch successive bytes from the source in reverse order.
- bit_endian
Endianness of the backing storage; either ‘big’ or ‘little’. Defaults to big (i.e. starting from the most-significant bit (0x80) through least-significant bit (0x10)).
- io_endian
Endianness of data returned from read/write; either ‘big’ or ‘little’. Defaults to big (i.e. starting from the most-significant bit (0x80) through least-significant bit (0x10)).
- seek(offset, origin='start')[source]¶
Seek to a location in the target.
- offset
Relative offset in the target to move to. Can be an integer byte offset, or a tuple containing the byte and bit offsets.
- origin
Position to measure the offset from. Can be either “start”, “current” or “end”. Defaults to “start”.
- mrcrowbar.bits.mask(size)¶