diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-03 22:51:54 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-03 22:52:40 -0500 |
commit | 921b43ea8aaa377a42a11cede653165ec84d8aa4 (patch) | |
tree | 23bacddbc9b9b0063b45a50eb6ec8bcb28eb9b2f /src/bitfield | |
parent | 09dc97c24f9f9a9c2638405167bffe339f666e2a (diff) |
Fix some implicitly defined functions - import proper headers.
Diffstat (limited to 'src/bitfield')
-rw-r--r-- | src/bitfield/8byte.c | 4 | ||||
-rw-r--r-- | src/bitfield/bitfield.c | 4 | ||||
-rw-r--r-- | src/bitfield/bitfield.h | 6 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/bitfield/8byte.c b/src/bitfield/8byte.c index d3160934..bfceb788 100644 --- a/src/bitfield/8byte.c +++ b/src/bitfield/8byte.c @@ -6,10 +6,6 @@ #define EIGHTBYTE_BIT (8 * sizeof(uint64_t)) -uint64_t bitmask(const uint8_t bit_count) { - return (((uint64_t)0x1) << bit_count) - 1; -} - uint8_t eightbyte_get_nibble(const uint64_t source, const uint8_t nibble_index, const bool data_is_big_endian) { return get_bit_field(source, NIBBLE_SIZE * nibble_index, NIBBLE_SIZE, diff --git a/src/bitfield/bitfield.c b/src/bitfield/bitfield.c index ae1be403..3b0c5fdd 100644 --- a/src/bitfield/bitfield.c +++ b/src/bitfield/bitfield.c @@ -3,6 +3,10 @@ #include <string.h> #include <stddef.h> +uint64_t bitmask(const uint8_t bit_count) { + return (((uint64_t)0x1) << bit_count) - 1; +} + 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; diff --git a/src/bitfield/bitfield.h b/src/bitfield/bitfield.h index ef04d9ca..5dd976f0 100644 --- a/src/bitfield/bitfield.h +++ b/src/bitfield/bitfield.h @@ -138,8 +138,14 @@ bool copy_bytes_right_aligned(const uint8_t source[], const uint16_t source_leng bool set_nibble(const uint16_t nibble_index, const uint8_t value, uint8_t* destination, const uint16_t destination_length); +/* Private: + */ uint16_t bits_to_bytes(uint32_t bits); +/* Private: + */ +uint64_t bitmask(const uint8_t bit_count); + #ifdef __cplusplus } #endif |