Skip to content

Commit

Permalink
fix CRC 8/16/24 calculation
Browse files Browse the repository at this point in the history
fix initial value of CRC8, CRC16, CRC24.
closes issue jgaeddert#370
  • Loading branch information
dl3yc authored Jun 30, 2024
1 parent c0f60ea commit ecd75b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/fec/src/crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ unsigned int checksum_generate_key(unsigned char *_data,
unsigned int crc8_generate_key(unsigned char *_msg,
unsigned int _n)
{
unsigned int i, j, b, mask, key8=~0;
unsigned int i, j, b, mask, key8=0xFF;
unsigned int poly = liquid_reverse_byte_gentab[CRC8_POLY];
for (i=0; i<_n; i++) {
b = _msg[i];
Expand Down Expand Up @@ -275,7 +275,7 @@ unsigned int crc8_generate_key(unsigned char *_msg,
unsigned int crc16_generate_key(unsigned char *_msg,
unsigned int _n)
{
unsigned int i, j, b, mask, key16=~0;
unsigned int i, j, b, mask, key16=0xFFFF;
unsigned int poly = liquid_reverse_uint16(CRC16_POLY);
for (i=0; i<_n; i++) {
b = _msg[i];
Expand Down Expand Up @@ -303,7 +303,7 @@ unsigned int crc16_generate_key(unsigned char *_msg,
unsigned int crc24_generate_key(unsigned char *_msg,
unsigned int _n)
{
unsigned int i, j, b, mask, key24=~0;
unsigned int i, j, b, mask, key24=0xFFFFFF;
unsigned int poly = liquid_reverse_uint24(CRC24_POLY);
for (i=0; i<_n; i++) {
b = _msg[i];
Expand Down

0 comments on commit ecd75b8

Please sign in to comment.