Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CRC 8/16/24 calculation #371

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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