1 #include <canutil/read.h>
2 #include <bitfield/bitfield.h>
3 #include <bitfield/8byte.h>
5 float eightbyte_parse_float(uint64_t data, uint8_t bit_offset, uint8_t bit_size,
6 float factor, float offset) {
7 uint64_t raw = eightbyte_get_bit_field(data, bit_offset, bit_size, true);
8 return raw * factor + offset;
11 bool eightbyte_parse_bool(uint64_t data, uint8_t bit_offset, uint8_t bit_size,
12 float factor, float offset) {
13 float value = eightbyte_parse_float(data, bit_offset, bit_size, factor, offset);
14 return value == 0.0 ? false : true;
17 float bitfield_parse_float(const uint8_t data[], const uint16_t size,
18 const uint8_t bit_offset, const uint8_t bit_size, const float factor,