1 #include <bitfield/bitfield.h>
6 uint8_t get_nibble(const uint8_t source[], const uint8_t source_length,
7 const uint8_t nibble_index) {
8 uint8_t byte_index = nibble_index / 2;
9 uint8_t result = get_byte(source, source_length, byte_index);
10 if(nibble_index % 2 == 0) {
11 result >>= NIBBLE_SIZE;
13 result &= bitmask(NIBBLE_SIZE);
17 uint8_t get_byte(const uint8_t source[], const uint8_t source_length,
18 const uint8_t byte_index) {
19 if(byte_index < source_length) {
20 return source[byte_index];