aravind21tech
Newbie level 4
- Joined
- Jul 28, 2014
- Messages
- 5
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 36
Hi all,
In the link below, CRC-32 is implemented in "C"
https://rosettacode.org/wiki/CRC-32#C
I can understand that 256 table entries are calculated. But I cannot get these 4 lines in that code
Normally in finding CRC bits are shifted 1 by 1. But 8 bits are shifted here.
Can some one elaborate the reason why 8 bits are shifted?
Why a 256 entries table is calculated?
What I meant is I can just interpret the code, but cannot able to match it with normal binary CRC calculation method.
In the link below, CRC-32 is implemented in "C"
https://rosettacode.org/wiki/CRC-32#C
I can understand that 256 table entries are calculated. But I cannot get these 4 lines in that code
Code C - [expand] 1 2 3 4 5 q = buf + len; for (p = buf; p < q; p++) { octet = *p; crc = (crc >> 8) ^ table[(crc & 0xff) ^ octet]; }
Normally in finding CRC bits are shifted 1 by 1. But 8 bits are shifted here.
Can some one elaborate the reason why 8 bits are shifted?
Why a 256 entries table is calculated?
What I meant is I can just interpret the code, but cannot able to match it with normal binary CRC calculation method.
Last edited: