1370b324cSopenharmony_ci/* XzCrc64.h -- CRC64 calculation 2370b324cSopenharmony_ci2023-04-02 : Igor Pavlov : Public domain */ 3370b324cSopenharmony_ci 4370b324cSopenharmony_ci#ifndef ZIP7_INC_XZ_CRC64_H 5370b324cSopenharmony_ci#define ZIP7_INC_XZ_CRC64_H 6370b324cSopenharmony_ci 7370b324cSopenharmony_ci#include <stddef.h> 8370b324cSopenharmony_ci 9370b324cSopenharmony_ci#include "7zTypes.h" 10370b324cSopenharmony_ci 11370b324cSopenharmony_ciEXTERN_C_BEGIN 12370b324cSopenharmony_ci 13370b324cSopenharmony_ciextern UInt64 g_Crc64Table[]; 14370b324cSopenharmony_ci 15370b324cSopenharmony_civoid Z7_FASTCALL Crc64GenerateTable(void); 16370b324cSopenharmony_ci 17370b324cSopenharmony_ci#define CRC64_INIT_VAL UINT64_CONST(0xFFFFFFFFFFFFFFFF) 18370b324cSopenharmony_ci#define CRC64_GET_DIGEST(crc) ((crc) ^ CRC64_INIT_VAL) 19370b324cSopenharmony_ci#define CRC64_UPDATE_BYTE(crc, b) (g_Crc64Table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 20370b324cSopenharmony_ci 21370b324cSopenharmony_ciUInt64 Z7_FASTCALL Crc64Update(UInt64 crc, const void *data, size_t size); 22370b324cSopenharmony_ciUInt64 Z7_FASTCALL Crc64Calc(const void *data, size_t size); 23370b324cSopenharmony_ci 24370b324cSopenharmony_ciEXTERN_C_END 25370b324cSopenharmony_ci 26370b324cSopenharmony_ci#endif 27