From: Romain Forlot Date: Sun, 15 Dec 2019 11:12:56 +0000 (+0100) Subject: converter: Improve the continental bit calcul X-Git-Tag: 8.99.5~18 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=334dbd3813551cb6d5e6dfb9d6625d9519caee2d;p=apps%2Fagl-service-can-low-level.git 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 --- 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; }