From f7bd2c2f38f3c82ffab88ac8cc23ec8404595efd Mon Sep 17 00:00:00 2001 From: rbiasini Date: Thu, 4 Jul 2019 02:27:21 -0700 Subject: [PATCH] Misra 10.4: fix last 2 violations (#242) --- board/drivers/gmlan_alt.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/board/drivers/gmlan_alt.h b/board/drivers/gmlan_alt.h index dcf27ade71bc69..55260162cfde27 100644 --- a/board/drivers/gmlan_alt.h +++ b/board/drivers/gmlan_alt.h @@ -44,7 +44,7 @@ int append_crc(char *in, int in_len) { unsigned int crc = 0; for (int i = 0; i < in_len; i++) { crc <<= 1; - if ((in[i] ^ ((crc >> 15) & 1U)) != 0U) { + if (((unsigned int)(in[i]) ^ ((crc >> 15) & 1U)) != 0U) { crc = crc ^ 0x4599U; } crc &= 0x7fffU; @@ -68,8 +68,8 @@ int append_bits(char *in, int in_len, char *app, int app_len) { int append_int(char *in, int in_len, int val, int val_len) { int in_len_copy = in_len; - for (int i = val_len-1; i >= 0; i--) { - in[in_len_copy] = ((unsigned int)(val) & (1U << (unsigned int)(i))) != 0; + for (int i = val_len - 1; i >= 0; i--) { + in[in_len_copy] = ((unsigned int)(val) & (1U << (unsigned int)(i))) != 0U; in_len_copy++; } return in_len_copy;