crc16: fix error
This commit is contained in:
parent
e6ca12f4c3
commit
fdbbe8dc9a
|
@ -116,7 +116,7 @@ uint16_t crc16part(FAR const uint8_t *src, size_t len, uint16_t crc16val)
|
|||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
crc16val = crc16_tab[((crc16val >> 8) & 255)] ^ (crc16val << 8) ^ src[i];
|
||||
crc16val = crc16_tab[((crc16val >> 8) & 0xff) ^ src[i]] ^ (crc16val << 8);
|
||||
}
|
||||
|
||||
return crc16val;
|
||||
|
|
|
@ -104,7 +104,7 @@ uint32_t crc32part(FAR const uint8_t *src, size_t len, uint32_t crc32val)
|
|||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
crc32val = crc32_tab[(crc32val ^ src[i]) & 0xff] ^ (crc32val >> 8);
|
||||
crc32val = crc32_tab[(crc32val & 0xff) ^ src[i]] ^ (crc32val >> 8);
|
||||
}
|
||||
return crc32val;
|
||||
}
|
||||
|
|
|
@ -124,13 +124,13 @@ uint8_t crc8part(FAR const uint8_t *src, size_t len, uint8_t crc8val)
|
|||
{
|
||||
size_t i;
|
||||
|
||||
crc8val ^= 0xFF;
|
||||
crc8val ^= 0xff;
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
crc8val = crc8_tab[crc8val ^ src[i]];
|
||||
}
|
||||
|
||||
return crc8val ^ 0xFF;
|
||||
return crc8val ^ 0xff;
|
||||
}
|
||||
|
||||
/************************************************************************************************
|
||||
|
|
Loading…
Reference in New Issue