summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-04 11:51:14 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-04 11:51:14 -0500
commitf0d31caa3955365f6a393d788831f4b53fade000 (patch)
tree10fff41de2ee6d9443a499aae7090bfb03ffe888 /src
parent28e30830755758d13458c05ebe2a8db5dc9f43a0 (diff)
Fix parse_bool tests.
Diffstat (limited to 'src')
-rw-r--r--src/bitfield/bitfield.c1
-rw-r--r--src/canutil/read.c2
-rw-r--r--src/canutil/read.h2
3 files changed, 3 insertions, 2 deletions
diff --git a/src/bitfield/bitfield.c b/src/bitfield/bitfield.c
index dddb0ee2..e40ab1ab 100644
--- a/src/bitfield/bitfield.c
+++ b/src/bitfield/bitfield.c
@@ -38,6 +38,7 @@ uint64_t get_bitfield(const uint8_t source[], const uint8_t source_length,
uint64_t whole;
uint8_t bytes[sizeof(uint64_t)];
} combined;
+ memset(combined.bytes, 0, sizeof(combined.bytes));
copy_bits_right_aligned(source, source_length, offset, bit_count,
combined.bytes, sizeof(combined.bytes));
if(BYTE_ORDER == LITTLE_ENDIAN) {
diff --git a/src/canutil/read.c b/src/canutil/read.c
index 3931721a..b662e9bd 100644
--- a/src/canutil/read.c
+++ b/src/canutil/read.c
@@ -23,7 +23,7 @@ float bitfield_parse_float(const uint8_t source[], const uint16_t source_length,
return raw * factor + offset;
}
-float bitfield_parse_bool(const uint8_t source[], const uint16_t source_length,
+bool bitfield_parse_bool(const uint8_t source[], const uint16_t source_length,
const uint8_t bit_offset, const uint8_t bit_size, const float factor,
const float offset) {
float value = bitfield_parse_float(source, source_length, bit_offset,
diff --git a/src/canutil/read.h b/src/canutil/read.h
index 733e3509..86fea785 100644
--- a/src/canutil/read.h
+++ b/src/canutil/read.h
@@ -70,7 +70,7 @@ bool eightbyte_parse_bool(uint64_t source, uint8_t bit_offset, uint8_t bit_size,
*
* Returns false if the value was 0, otherwise true.
*/
-float bitfield_parse_float(const uint8_t source[], const uint16_t source_size,
+bool bitfield_parse_bool(const uint8_t source[], const uint16_t source_size,
const uint8_t bit_offset, const uint8_t bit_size, const float factor,
const float offset);