From c2c7ef1dfe4cae6b5831ffab0ce5780b27e0c25e Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Sun, 29 Dec 2013 11:55:35 -0500 Subject: Standardize on snake_case naming as this is a C library. --- src/canutil/write.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/canutil/write.c') diff --git a/src/canutil/write.c b/src/canutil/write.c index 64b57297..14d2a449 100644 --- a/src/canutil/write.c +++ b/src/canutil/write.c @@ -1,19 +1,19 @@ #include "write.h" #include -uint64_t encodeFloat(float value, uint8_t bitPosition, uint8_t bitSize, +uint64_t bitfield_encode_float(float value, uint8_t bit_offset, uint8_t bit_size, float factor, float offset) { - float rawValue = (value - offset) / factor; - if(rawValue > 0) { + float raw = (value - offset) / factor; + if(raw > 0) { // round up to avoid losing precision when we cast to an int - rawValue += 0.5; + raw += 0.5; } uint64_t result = 0; - setBitField(&result, (uint64_t)rawValue, bitPosition, bitSize); + set_bit_field(&result, (uint64_t)raw, bit_offset, bit_size); return result; } -uint64_t encodeBoolean(bool value, uint8_t bitPosition, uint8_t bitSize, +uint64_t bitfield_encode_bool(bool value, uint8_t bit_offset, uint8_t bit_size, float factor, float offset) { - return encodeFloat(value, offset, factor, bitPosition, bitSize); + return bitfield_encode_float(value, offset, factor, bit_offset, bit_size); } -- cgit 1.2.3-korg