Go to the source code of this file.
Typedefs | |
typedef bitstream_state_s | bitstream_state_t |
Functions | |
void | bitstream_put (bitstream_state_t *s, uint8_t **c, uint32_t value, int bits) |
Put a chunk of bits into the output buffer. | |
uint32_t | bitstream_get (bitstream_state_t *s, const uint8_t **c, int bits) |
Get a chunk of bits from the input buffer. | |
void | bitstream_emit (bitstream_state_t *s, uint8_t **c) |
Emit any residual bits to the output buffer, without actually flushing them. This is useful for getting the buffer fully up to date, ready for things like CRC calculations, while allowing bitstream_put() to be used to continue the message later. | |
void | bitstream_flush (bitstream_state_t *s, uint8_t **c) |
Flush any residual bits to the output buffer. | |
bitstream_state_t * | bitstream_init (bitstream_state_t *s, int direction) |
Initialise a bitstream context. | |
int | bitstream_release (bitstream_state_t *s) |
int | bitstream_free (bitstream_state_t *s) |
typedef struct bitstream_state_s bitstream_state_t |
Bitstream handler state
void bitstream_emit | ( | bitstream_state_t * | s, | |
uint8_t ** | c | |||
) |
Emit any residual bits to the output buffer, without actually flushing them. This is useful for getting the buffer fully up to date, ready for things like CRC calculations, while allowing bitstream_put() to be used to continue the message later.
s | A pointer to the bitstream context. | |
c | A pointer to the bitstream output buffer. |
void bitstream_flush | ( | bitstream_state_t * | s, | |
uint8_t ** | c | |||
) |
Flush any residual bits to the output buffer.
s | A pointer to the bitstream context. | |
c | A pointer to the bitstream output buffer. |
uint32_t bitstream_get | ( | bitstream_state_t * | s, | |
const uint8_t ** | c, | |||
int | bits | |||
) |
Get a chunk of bits from the input buffer.
s | A pointer to the bitstream context. | |
c | A pointer to the bitstream input buffer. | |
bits | The number of bits of value to be grabbed. 1 to 25 bits is valid. |
bitstream_state_t* bitstream_init | ( | bitstream_state_t * | s, | |
int | direction | |||
) |
Initialise a bitstream context.
s | A pointer to the bitstream context. | |
lsb_first | TRUE if the bit stream is LSB first, else its MSB first. |
void bitstream_put | ( | bitstream_state_t * | s, | |
uint8_t ** | c, | |||
uint32_t | value, | |||
int | bits | |||
) |
Put a chunk of bits into the output buffer.
s | A pointer to the bitstream context. | |
c | A pointer to the bitstream output buffer. | |
value | The value to be pushed into the output buffer. | |
bits | The number of bits of value to be pushed. 1 to 25 bits is valid. |