From: Michal Sojka Date: Wed, 6 Nov 2013 17:46:23 +0000 (+0100) Subject: Data bytes must not be converted to big endian X-Git-Tag: fix-allnoconfig~124 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/can-benchmark.git/commitdiff_plain/5cef6d7aff4feea862f119823e6b33d72cb69a34?hp=d2073a52c1ba52749c1c9522c42ccbfc83b70b1d Data bytes must not be converted to big endian I don't know why I did that before :-o --- diff --git a/latester/latester.c b/latester/latester.c index b0937ba..a2f4f18 100644 --- a/latester/latester.c +++ b/latester/latester.c @@ -251,8 +251,7 @@ unsigned calc_stuff_bits(struct can_frame *frame) { (!!(frame->can_id & CAN_RTR_FLAG)) << 6 | 0 << 4 | frame->can_dlc & 0xf; - bitmap[2] = htonl(((uint32_t*)frame->data)[0]); - bitmap[3] = htonl(((uint32_t*)frame->data)[1]); + memcpy(&bitmap[2], &frame->data, frame->can_dlc); start = 27; end = 64 + 8*frame->can_dlc; } else { @@ -265,8 +264,7 @@ unsigned calc_stuff_bits(struct can_frame *frame) { (!!(frame->can_id & CAN_RTR_FLAG)) << 6 | 0 << 4 | frame->can_dlc & 0xf; - bitmap[1] = htonl(((uint32_t*)frame->data)[0]); - bitmap[2] = htonl(((uint32_t*)frame->data)[1]); + memcpy(&bitmap[1], &frame->data, frame->can_dlc); start = 13; end = 32 + 8*frame->can_dlc; }