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

Use XOR instead of AND operation when calculating CRC #40

Open
xy007man opened this issue Oct 29, 2024 · 0 comments
Open

Use XOR instead of AND operation when calculating CRC #40

xy007man opened this issue Oct 29, 2024 · 0 comments

Comments

@xy007man
Copy link

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 ^ *d;
    crc = crc_table[tbl_idx] & 0xff;
    d++;
}
return crc & 0xff; ==> crc ^ 0xff

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant