17#include "aeongames/CRC.hpp"
27 uint32_t
crc32i (
const char* message,
size_t size, uint32_t previous_crc )
29 assert ( message !=
nullptr );
31 uint32_t remainder = reflect32<16> ( previous_crc ) ^ 0xFFFFFFFF;
36 for (
size_t byte = 0;
byte < size; ++byte )
38 data = reflect32<4> (
static_cast<uint8_t
> ( message[
byte] ) ) ^ ( remainder >> ( 32 - 8 ) );
39 remainder = crc_table32[data] ^ ( remainder << 8 );
44 return reflect32<16> ( remainder ) ^ 0xFFFFFFFF;
53 uint64_t
crc64i (
const char* message,
size_t size, uint64_t previous_crc )
55 assert ( message !=
nullptr );
57 uint64_t remainder = reflect64<32> ( previous_crc ) ^ 0xFFFFFFFFFFFFFFFF;
62 for (
size_t byte = 0;
byte < size; ++byte )
64 data = reflect64<4> (
static_cast<uint8_t
> ( message[
byte] ) ) ^ ( remainder >> ( 64 - 8 ) );
65 remainder = crc_table64[data] ^ ( remainder << 8 );
70 return reflect64<32> ( remainder ) ^ 0xFFFFFFFFFFFFFFFF;
<- This is here just for the literals
uint32_t crc32i(const char *message, size_t size, uint32_t previous_crc)
Compute the CRC32 of a given message, continuing from a previous CRC value.
uint64_t crc64i(const char *message, size_t size, uint64_t previous_crc)
Compute the CRC64 of a given message, continuing from a previous CRC value.