From ca0ff1ab89f0e9870ffff74b7a3b0f199f7bebe4 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 6 Jan 2023 16:33:28 -0500 Subject: [PATCH] crcspeed Compatibility With C++ --- src/crcspeed/crc64speed.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/crcspeed/crc64speed.c b/src/crcspeed/crc64speed.c index b1a7bbb94..e4cccdc69 100644 --- a/src/crcspeed/crc64speed.c +++ b/src/crcspeed/crc64speed.c @@ -124,7 +124,7 @@ static inline uint_fast64_t crc_reflect(uint_fast64_t data, size_t data_len) { * \return The updated crc value. ******************************************************************************/ uint64_t crc64(uint_fast64_t crc, const void *in_data, const uint64_t len) { - const uint8_t *data = in_data; + const uint8_t *data = (uint8_t *) in_data; bool bit; for (uint64_t offset = 0; offset < len; offset++) { @@ -152,7 +152,7 @@ uint64_t crc64(uint_fast64_t crc, const void *in_data, const uint64_t len) { /* Only for testing; doesn't support DUAL */ uint64_t crc64_lookup(uint64_t crc, const void *in_data, const uint64_t len) { - const uint8_t *data = in_data; + const uint8_t *data = (uint8_t *) in_data; for (size_t i = 0; i < len; i++) { crc = crc64_table[0][(uint8_t)crc ^ data[i]] ^ (crc >> 8); } @@ -167,7 +167,7 @@ bool crc64speed_init(void) { #else should_init(crc64_table_little, LITTLE1); #endif - crcspeed64little_init(crc64, dual ? crc64_table_little : crc64_table); + crcspeed64little_init(crc64, dual ? (uint64_t (*)[256]) crc64_table_little : crc64_table); return true; } @@ -178,7 +178,7 @@ bool crc64speed_init_big(void) { #else should_init(crc64_table_big, BIG1); #endif - crcspeed64big_init(crc64, dual ? crc64_table_big : crc64_table); + crcspeed64big_init(crc64, dual ? (uint64_t (*)[256]) crc64_table_big : crc64_table); return true; } @@ -189,7 +189,7 @@ uint64_t crc64speed(uint64_t crc, const void *s, const uint64_t l) { #else check_init(crc64_table_little, LITTLE1); #endif - return crcspeed64little(dual ? crc64_table_little : crc64_table, crc, + return crcspeed64little(dual ? (uint64_t (*)[256]) crc64_table_little : crc64_table, crc, (void *)s, l); } @@ -200,7 +200,7 @@ uint64_t crc64speed_big(uint64_t crc, const void *s, const uint64_t l) { #else check_init(crc64_table_big, BIG1); #endif - return crcspeed64big(dual ? crc64_table_big : crc64_table, crc, (void *)s, + return crcspeed64big(dual ? (uint64_t (*)[256]) crc64_table_big : crc64_table, crc, (void *)s, l); }