Closed RedX2501 closed 9 years ago
Thanks for the report and sorry for the late response. This is/was a bug and should be fixed with 61f397b.
The update function now is:
crc_t crc_update(crc_t crc, const void *data, size_t data_len)
{
const unsigned char *d = (const unsigned char *)data;
unsigned int tbl_idx;
while (data_len--) {
tbl_idx = ((crc >> 3) ^ *d);
crc = (crc_table[tbl_idx]) & (0x1f << 3);
d++;
}
return crc & (0x1f << 3);
}
When using the following command line:
/pycrc.py --model crc-5 --algorithm table-driven --std=c89 --generate c -o source.c
a source.c is generated with following crc_update:
with crc_t typedef'ed to
unsigned char
.This means that the
crc >> 8
is always 0. Is this intended?