summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bitfield/8byte.c4
-rw-r--r--src/bitfield/bitfield.c4
-rw-r--r--src/bitfield/bitfield.h6
-rw-r--r--src/canutil/read.c2
-rw-r--r--src/canutil/write.c3
5 files changed, 14 insertions, 5 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
diff --git a/src/canutil/read.c b/src/canutil/read.c
index 5e882c3d..fddf75e3 100644
--- a/src/canutil/read.c
+++ b/src/canutil/read.c
@@ -1,4 +1,6 @@
+#include <canutil/read.h>
#include <bitfield/bitfield.h>
+#include <bitfield/8byte.h>
float bitfield_parse_float(uint64_t data, uint8_t bit_offset, uint8_t bit_size,
float factor, float offset) {
diff --git a/src/canutil/write.c b/src/canutil/write.c
index 583c2513..12c8fa28 100644
--- a/src/canutil/write.c
+++ b/src/canutil/write.c
@@ -1,5 +1,6 @@
-#include "write.h"
+#include <canutil/write.h>
#include <bitfield/bitfield.h>
+#include <bitfield/8byte.h>
uint64_t bitfield_encode_float(float value, uint8_t bit_offset, uint8_t bit_size,
float factor, float offset) {