diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2019-11-23 13:39:52 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2020-01-09 15:55:03 +0100 |
commit | 78e8a778786bf3f9050e55d99dd2b4338e8f4a8e (patch) | |
tree | 8dde7b0f50ea497f7a79ba60909570305328cb26 /libs/bitfield-c/src/canutil/read.c | |
parent | d76433ade0b75c8cc2b45fdae52a21d7fb28f526 (diff) |
bitfield-c: use unsigned int instead of uint8_t
Use unsigned int instead of uint8_t upon destination and source array length.
This is needed to handle gathered multi-frames message data which could
be greater than 1 simple messages.
Bug-AGL: SPEC-2988
Change-Id: I107bff383c2d0771dbc2a30770ec5c195b1c22ac
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'libs/bitfield-c/src/canutil/read.c')
-rw-r--r-- | libs/bitfield-c/src/canutil/read.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/bitfield-c/src/canutil/read.c b/libs/bitfield-c/src/canutil/read.c index d0cbb71a..5790a7a1 100644 --- a/libs/bitfield-c/src/canutil/read.c +++ b/libs/bitfield-c/src/canutil/read.c @@ -6,27 +6,27 @@ static float decode_float(uint64_t raw, float factor, float offset) { return raw * factor + offset; } -float eightbyte_parse_float(uint64_t data, uint8_t bit_offset, uint8_t bit_size, +float eightbyte_parse_float(uint64_t data, unsigned int bit_offset, unsigned int bit_size, float factor, float offset) { return decode_float(eightbyte_get_bitfield(data, bit_offset, bit_size, true), factor, offset); } -bool eightbyte_parse_bool(uint64_t data, uint8_t bit_offset, uint8_t bit_size, +bool eightbyte_parse_bool(uint64_t data, unsigned int bit_offset, unsigned int bit_size, float factor, float offset) { float value = eightbyte_parse_float(data, bit_offset, bit_size, factor, offset); return value == 0.0 ? false : true; } -float bitfield_parse_float(const uint8_t source[], const uint16_t source_length, - const uint8_t bit_offset, const uint8_t bit_size, const float factor, +float bitfield_parse_float(const uint8_t source[], const unsigned int source_length, + const unsigned int bit_offset, const unsigned int bit_size, const float factor, const float offset) { return decode_float(get_bitfield(source, source_length, bit_offset, bit_size), factor, offset); } -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, +bool bitfield_parse_bool(const uint8_t source[], const unsigned int source_length, + const unsigned int bit_offset, const unsigned int bit_size, const float factor, const float offset) { float value = bitfield_parse_float(source, source_length, bit_offset, bit_size, factor, offset); |