summaryrefslogtreecommitdiffstats
path: root/low-can-binding/utils
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-12-15 12:12:56 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2020-01-09 16:25:36 +0100
commit334dbd3813551cb6d5e6dfb9d6625d9519caee2d (patch)
tree7fc34e4271ad8d5df696f47285f26b033a7eb5d7 /low-can-binding/utils
parent475e6c277fd6863545e44fe560b2657ab042ab8b (diff)
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 <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/utils')
-rw-r--r--low-can-binding/utils/converter.cpp2
1 files changed, 1 insertions, 1 deletions
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;
}