Rename the 32-bit CRC functions
The new names make it easier to identify the normal and reflected variant of the CRC function.
This commit is contained in:
parent
d327aea6ff
commit
00033e4af0
@ -161,7 +161,7 @@ checksum_crc16r_ccitt (const unsigned char data[], unsigned int size, unsigned s
|
||||
|
||||
|
||||
unsigned int
|
||||
checksum_crc32 (const unsigned char data[], unsigned int size)
|
||||
checksum_crc32r (const unsigned char data[], unsigned int size)
|
||||
{
|
||||
static const unsigned int crc_table[] = {
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
|
||||
@ -206,7 +206,7 @@ checksum_crc32 (const unsigned char data[], unsigned int size)
|
||||
}
|
||||
|
||||
unsigned int
|
||||
checksum_crc32b (const unsigned char data[], unsigned int size)
|
||||
checksum_crc32 (const unsigned char data[], unsigned int size)
|
||||
{
|
||||
static const unsigned int crc_table[] = {
|
||||
0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005,
|
||||
|
||||
@ -45,10 +45,10 @@ unsigned short
|
||||
checksum_crc16r_ccitt (const unsigned char data[], unsigned int size, unsigned short init, unsigned short xorout);
|
||||
|
||||
unsigned int
|
||||
checksum_crc32 (const unsigned char data[], unsigned int size);
|
||||
checksum_crc32r (const unsigned char data[], unsigned int size);
|
||||
|
||||
unsigned int
|
||||
checksum_crc32b (const unsigned char data[], unsigned int size);
|
||||
checksum_crc32 (const unsigned char data[], unsigned int size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -528,7 +528,7 @@ liquivision_lynx_device_foreach (dc_device_t *abstract, dc_dive_callback_t callb
|
||||
memcpy (header + 0, device->info + 2, 4);
|
||||
memcpy (header + 4, logbook + offset + 4, headersize - 4);
|
||||
unsigned int crc = array_uint32_le (logbook + offset + 0);
|
||||
unsigned int ccrc = checksum_crc32b (header, headersize - unused);
|
||||
unsigned int ccrc = checksum_crc32 (header, headersize - unused);
|
||||
if (crc != ccrc) {
|
||||
WARNING (abstract->context, "Invalid dive checksum (%08x %08x)", crc, ccrc);
|
||||
status = DC_STATUS_DATAFORMAT;
|
||||
|
||||
@ -352,7 +352,7 @@ suunto_eonsteel_receive_ble(suunto_eonsteel_device_t *device, unsigned char data
|
||||
unsigned int nbytes = transferred - CRC_SIZE;
|
||||
|
||||
unsigned int crc = array_uint32_le(buffer + nbytes);
|
||||
unsigned int ccrc = checksum_crc32(buffer, nbytes);
|
||||
unsigned int ccrc = checksum_crc32r(buffer, nbytes);
|
||||
if (crc != ccrc) {
|
||||
ERROR(device->base.context, "Invalid checksum (expected %08x, received %08x).", ccrc, crc);
|
||||
return DC_STATUS_PROTOCOL;
|
||||
@ -411,7 +411,7 @@ suunto_eonsteel_send(suunto_eonsteel_device_t *device,
|
||||
}
|
||||
|
||||
// 4 byte LE checksum
|
||||
unsigned int crc = checksum_crc32(buf + 2, size + HEADER_SIZE);
|
||||
unsigned int crc = checksum_crc32r(buf + 2, size + HEADER_SIZE);
|
||||
put_le32(crc, buf + 14 + size);
|
||||
|
||||
if (dc_iostream_get_transport(device->iostream) == DC_TRANSPORT_BLE) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user