10#define TOPBIT(X) (1 << ((X) - 1))
23#define bit_lib_increment_index(index, length) (index = (((index) + 1) % (length)))
29#define bit_lib_bit_is_set(data, index) (((data) & (1 << (index))) != 0)
35#define bit_lib_bit_is_not_set(data, index) (((data) & (1 << (index))) == 0)
42void bit_lib_push_bit(uint8_t* data,
size_t data_size,
bool bit);
49void bit_lib_set_bit(uint8_t* data,
size_t position,
bool bit);
57void bit_lib_set_bits(uint8_t* data,
size_t position, uint8_t
byte, uint8_t length);
64bool bit_lib_get_bit(
const uint8_t* data,
size_t position);
73uint8_t bit_lib_get_bits(
const uint8_t* data,
size_t position, uint8_t length);
82uint16_t bit_lib_get_bits_16(
const uint8_t* data,
size_t position, uint8_t length);
91uint32_t bit_lib_get_bits_32(
const uint8_t* data,
size_t position, uint8_t length);
100uint64_t bit_lib_get_bits_64(
const uint8_t* data,
size_t position, uint8_t length);
108bool bit_lib_test_parity_32(uint32_t bits, BitLibParity parity);
121bool bit_lib_test_parity(
126 uint8_t parity_length);
140size_t bit_lib_add_parity(
144 size_t dest_position,
145 uint8_t source_length,
146 uint8_t parity_length,
147 BitLibParity parity);
158size_t bit_lib_remove_bit_every_nth(uint8_t* data,
size_t position, uint8_t length, uint8_t n);
169void bit_lib_copy_bits(
173 const uint8_t* source,
174 size_t source_position);
183void bit_lib_reverse_bits(uint8_t* data,
size_t position, uint8_t length);
191uint8_t bit_lib_get_bit_count(uint32_t data);
199void bit_lib_print_bits(
const uint8_t* data,
size_t length);
215void bit_lib_print_regions(
227uint16_t bit_lib_reverse_16_fast(uint16_t data);
235uint8_t bit_lib_reverse_8_fast(uint8_t
byte);
249uint16_t bit_lib_crc8(
270uint16_t bit_lib_crc16(
287void bit_lib_num_to_bytes_be(uint64_t src, uint8_t len, uint8_t* dest);
297void bit_lib_num_to_bytes_le(uint64_t src, uint8_t len, uint8_t* dest);
306uint64_t bit_lib_bytes_to_num_be(
const uint8_t* src, uint8_t len);
315uint64_t bit_lib_bytes_to_num_le(
const uint8_t* src, uint8_t len);
325uint64_t bit_lib_bytes_to_num_bcd(
const uint8_t* src, uint8_t len,
bool* is_bcd);