Data Structures | |
| struct | bit_buffer_tag |
Defines | |
| #define | BIT_BUFFER_OK 0 |
| #define | BIT_BUFFER_OVERFLOW 1 |
| #define | BIT_BUFFER_UNDERFLOW 2 |
| #define | write_0(_bb) write_bits(_bb, 0UL, 1) |
| #define | write_1(_bb) write_bits(_bb, 1UL, 1) |
| #define | read_bit(_bb, _bit) read_bits(_bb, _bit, 1) |
Typedefs | |
| typedef struct bit_buffer_tag | bit_buffer |
Functions | |
| void | init_bits (bit_buffer *bb, unsigned char *buf, int size) |
| int | write_bits (bit_buffer *bb, int value, int size) |
| int | read_bits (bit_buffer *bb, int *value, int size) |
| int | flush_bits (bit_buffer *bb) |
| #define BIT_BUFFER_OK 0 |
All bits are successfuly processed
Referenced by decode_refinement_pass(), encode_refinement_pass(), flush_bits(), read_bits(), speck_decode_S(), speck_encode_S(), speck_process_I(), speck_process_S(), speck_unprocess_I(), speck_unprocess_S(), and write_bits().
| #define BIT_BUFFER_OVERFLOW 1 |
Cannot write bits, output buffer is full
Referenced by speck_encode_I(), and write_bits().
| #define BIT_BUFFER_UNDERFLOW 2 |
Cannot read bits, input buffer is empty
Referenced by read_bits(), and speck_decode_I().
| #define write_0 | ( | _bb | ) | write_bits(_bb, 0UL, 1) |
Write one zero bit
Referenced by encode_refinement_pass(), speck_encode_S(), speck_process_I(), and speck_process_S().
| #define write_1 | ( | _bb | ) | write_bits(_bb, 1UL, 1) |
Write one unity bit
Referenced by encode_refinement_pass(), speck_encode_S(), speck_process_I(), and speck_process_S().
| #define read_bit | ( | _bb, | |||
| _bit | ) | read_bits(_bb, _bit, 1) |
Read one bit
Referenced by decode_refinement_pass(), speck_decode_S(), speck_unprocess_I(), and speck_unprocess_S().
| typedef struct bit_buffer_tag bit_buffer |
Bit-buffer structure
This structure represents bit-buffer.
| void init_bits | ( | bit_buffer * | bb, | |
| unsigned char * | buf, | |||
| int | size | |||
| ) |
Initialize bit-buffer for reading or writting
This function initializes bit-buffer bb for reading or writting bits.
| bb | Bit-buffer to initialize | |
| buf | Actual input/output buffer | |
| size | Actual buffer size |
VOID References bit_buffer_tag::bits, bit_buffer_tag::end, bit_buffer_tag::next, bit_buffer_tag::pending, and bit_buffer_tag::start.
Referenced by speck_decode(), and speck_encode().
| int write_bits | ( | bit_buffer * | bb, | |
| int | value, | |||
| int | size | |||
| ) |
Write bits
This function writes size least significant bits of the value to the bit-buffer bb.
| bb | Bit-buffer | |
| value | Bits to write | |
| size | Number of bits to write |
References BIT_BUFFER_OK, BIT_BUFFER_OVERFLOW, bit_buffer_tag::bits, bit_buffer_tag::end, bit_buffer_tag::next, and bit_buffer_tag::pending.
Referenced by flush_bits(), and speck_encode().
| int read_bits | ( | bit_buffer * | bb, | |
| int * | value, | |||
| int | size | |||
| ) |
Read bits
This function reads size least significant bits from the bit-buffer bb into the value argument.
| bb | Bit-buffer | |
| value | Location to store the bits | |
| size | Number of bits to read |
References BIT_BUFFER_OK, BIT_BUFFER_UNDERFLOW, bit_buffer_tag::bits, bit_buffer_tag::end, bit_buffer_tag::next, and bit_buffer_tag::pending.
Referenced by speck_decode().
| int flush_bits | ( | bit_buffer * | bb | ) |
Flush bits
This function flushes all pending bits if there are any.
| bb | Bit-buffer |
References BIT_BUFFER_OK, bit_buffer_tag::pending, and write_bits().
Referenced by speck_encode().
1.5.6