diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2013-12-29 14:20:12 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2013-12-29 14:21:27 -0500 |
commit | 3a6af99be9a10f795b84a5783939b86d7102fb63 (patch) | |
tree | 237302584675ab0d838f70e52a20f429c7074da7 /src | |
parent | e5a2a6b9550319cf05c3a3ae93080b17d322078e (diff) |
Standardize function names to snake_case.
Diffstat (limited to 'src')
-rw-r--r-- | src/bitfield/bitarray.c | 6 | ||||
-rw-r--r-- | src/bitfield/bitfield.c | 6 | ||||
-rw-r--r-- | src/bitfield/bitfield.h | 14 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/bitfield/bitarray.c b/src/bitfield/bitarray.c index f8c23527..35fc2d9e 100644 --- a/src/bitfield/bitarray.c +++ b/src/bitfield/bitarray.c @@ -20,7 +20,7 @@ static const uint8_t reverse_mask[] = static const uint8_t reverse_mask_xor[] = { 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x00 }; -bool copyBits(const uint8_t* source_origin, const uint16_t source_length, +bool copy_bits(const uint8_t* source_origin, const uint16_t source_length, const uint16_t source_offset, uint16_t bit_count, uint8_t* destination_origin, const uint16_t destination_length, const uint16_t destination_offset) { @@ -118,10 +118,10 @@ uint8_t find_end_bit(const uint16_t numBits) { return endBit == 0 ? CHAR_BIT : endBit; } -bool copyBitsRightAligned(const uint8_t source[], const uint16_t source_length, +bool copy_bits_right_aligned(const uint8_t source[], const uint16_t source_length, const uint16_t offset, const uint16_t bit_count, uint8_t* destination, const uint16_t destination_length) { - return copyBits(source, source_length, offset, bit_count, destination, + return copy_bits(source, source_length, offset, bit_count, destination, destination_length, // provide a proper destination offset so the result is right // aligned diff --git a/src/bitfield/bitfield.c b/src/bitfield/bitfield.c index 3bf00ac0..7dfa7cd4 100644 --- a/src/bitfield/bitfield.c +++ b/src/bitfield/bitfield.c @@ -5,10 +5,10 @@ #define NIBBLE_SIZE (CHAR_BIT / 2) -uint8_t getNibble(const uint8_t source[], const uint8_t source_length, +uint8_t get_nibble(const uint8_t source[], const uint8_t source_length, const uint8_t nibble_index) { uint8_t byte_index = nibble_index / 2; - uint8_t result = getByte(source, source_length, byte_index); + uint8_t result = get_byte(source, source_length, byte_index); if(nibble_index % 2 == 0) { result >>= NIBBLE_SIZE; } @@ -16,7 +16,7 @@ uint8_t getNibble(const uint8_t source[], const uint8_t source_length, return result; } -uint8_t getByte(const uint8_t source[], const uint8_t source_length, +uint8_t get_byte(const uint8_t source[], const uint8_t source_length, const uint8_t byte_index) { if(byte_index < source_length) { return source[byte_index]; diff --git a/src/bitfield/bitfield.h b/src/bitfield/bitfield.h index 6f5f1c18..52ed143d 100644 --- a/src/bitfield/bitfield.h +++ b/src/bitfield/bitfield.h @@ -17,7 +17,7 @@ extern "C" { * * Returns the retreived nibble, right aligned in a uint8_t. */ -uint8_t getNibble(const uint8_t source[], const uint8_t source_length, +uint8_t get_nibble(const uint8_t source[], const uint8_t source_length, const uint8_t nibble_index); /* Public: Return a single byte from the byte array, with range checking. @@ -28,7 +28,7 @@ uint8_t getNibble(const uint8_t source[], const uint8_t source_length, * * Returns the retreived byte. */ -uint8_t getByte(const uint8_t source[], const uint8_t source_length, +uint8_t get_byte(const uint8_t source[], const uint8_t source_length, const uint8_t byte_index); /* Public: Copy a range of bits from one bit array to another. @@ -44,7 +44,7 @@ uint8_t getByte(const uint8_t source[], const uint8_t source_length, * * uint8_t source[4] = {0x11, 0x22, 0x33, 0x44}; * uint8_t destination[4] = {0}; - * copyBits(source, sizeof(source), 8, 8, destination, + * copy_bits(source, sizeof(source), 8, 8, destination, * sizeof(destination), 0); * // destination[0] == 0x22 * // destination[1] == 0x0 @@ -73,7 +73,7 @@ uint8_t getByte(const uint8_t source[], const uint8_t source_length, * Returns true if the copy was successful and false if the range exceeded the * size of the source or destination, or if the range size negative or 0. */ -bool copyBits(const uint8_t* source_origin, const uint16_t source_length, +bool copy_bits(const uint8_t* source_origin, const uint16_t source_length, const uint16_t source_offset, uint16_t bit_count, uint8_t* destination_origin, const uint16_t destination_length, const uint16_t destination_offset); @@ -88,7 +88,7 @@ bool copyBits(const uint8_t* source_origin, const uint16_t source_length, * * uint8_t source[4] = {0x11, 0x22, 0x33, 0x44}; * uint8_t destination[4] = {0}; - * copyBitsRightAligned(source, sizeof(source), 8, 8, destination, + * copy_bits_right_aligned(source, sizeof(source), 8, 8, destination, * sizeof(destination)); * // destination[0] == 0x0 * // destination[1] == 0x0 @@ -98,13 +98,13 @@ bool copyBits(const uint8_t* source_origin, const uint16_t source_length, * int value = (int)destination; * // value == 0x22 == 32 * - * The arguments are the same as copyBits, but without the destination_offset + * The arguments are the same as copy_bits, but without the destination_offset * option - that's set automatically to right align the result. * * Returns true if the copy was successful and false if the range exceeded the * size of the source or destination, or if the range size negative or 0. */ -bool copyBitsRightAligned(const uint8_t source[], const uint16_t source_length, +bool copy_bits_right_aligned(const uint8_t source[], const uint16_t source_length, const uint16_t offset, const uint16_t bit_count, uint8_t* destination, const uint16_t destination_length); |