hash.c - Avoid naming local variables 'crc32'

This commit is contained in:
twinaphex 2014-10-21 00:25:36 +02:00
parent dbb5f02e9d
commit 2138a57efb

10
hash.c
View File

@ -257,18 +257,18 @@ static const uint32_t crc32_table[256] = {
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
uint32_t crc32_adjust(uint32_t crc32, uint8_t input)
uint32_t crc32_adjust(uint32_t checksum, uint8_t input)
{
return ((crc32 >> 8) & 0x00ffffff) ^ crc32_table[(crc32 ^ input) & 0xff];
return ((checksum >> 8) & 0x00ffffff) ^ crc32_table[(checksum ^ input) & 0xff];
}
uint32_t crc32_calculate(const uint8_t *data, size_t length)
{
size_t i;
uint32_t crc32 = ~0;
uint32_t checksum = ~0;
for (i = 0; i < length; i++)
crc32 = crc32_adjust(crc32, data[i]);
return ~crc32;
checksum = crc32_adjust(checksum, data[i]);
return ~checksum;
}
#endif