crc_be: bugfix: use only the last two bytes to index crc_table

This commit is contained in:
cojocar 2013-11-14 11:12:58 +01:00
parent dfbf7f02d9
commit b4acc03e65

View File

@ -42,7 +42,7 @@ void crc_fill_table(ulong *table, int big, ulong polynomial)
void crc_be_cycle(ulong *table, ulong *remainder, char c) void crc_be_cycle(ulong *table, ulong *remainder, char c)
{ {
ulong byte = table[((*remainder) >> 24) ^ c]; ulong byte = table[(((*remainder) >> 24) ^ c) & 0xff];
*remainder = (((*remainder) << 8) ^ byte) & 0xFFFFFFFF; *remainder = (((*remainder) << 8) ^ byte) & 0xFFFFFFFF;
} }