Skip to content

Commit

Permalink
Misra 10.4: fix last 2 violations (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiasini authored Jul 4, 2019
1 parent 9be5fde commit f7bd2c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions board/drivers/gmlan_alt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit f7bd2c2

Please sign in to comment.