From 334dbd3813551cb6d5e6dfb9d6625d9519caee2d Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Sun, 15 Dec 2019 12:12:56 +0100 Subject: converter: Improve the continental bit calcul This is an improvment of the bit_position computing. This now operate only on full bytes to get the position. Change-Id: Idb4993a3c9922d50d02379139e7cbbe5a2cb501b Signed-off-by: Romain Forlot --- low-can-binding/utils/converter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/low-can-binding/utils/converter.cpp b/low-can-binding/utils/converter.cpp index 56625742..6c9cedbb 100644 --- a/low-can-binding/utils/converter.cpp +++ b/low-can-binding/utils/converter.cpp @@ -99,5 +99,5 @@ uint32_t converter_t::bit_position_swap(unsigned int msg_length, unsigned int bi */ uint32_t converter_t::continental_bit_position_mess(unsigned int msg_length, unsigned int bit_position, unsigned int bit_size) { - return bit_position + (CHAR_BIT - bit_position % CHAR_BIT) - bit_size; + return bit_position + CHAR_BIT - 2 * (bit_position % CHAR_BIT) - bit_size; } -- cgit 1.2.3-korg