1370b324cSopenharmony_ci/* 7zCrc.h -- CRC32 calculation 2370b324cSopenharmony_ci2023-04-02 : Igor Pavlov : Public domain */ 3370b324cSopenharmony_ci 4370b324cSopenharmony_ci#ifndef ZIP7_INC_7Z_CRC_H 5370b324cSopenharmony_ci#define ZIP7_INC_7Z_CRC_H 6370b324cSopenharmony_ci 7370b324cSopenharmony_ci#include "7zTypes.h" 8370b324cSopenharmony_ci 9370b324cSopenharmony_ciEXTERN_C_BEGIN 10370b324cSopenharmony_ci 11370b324cSopenharmony_ciextern UInt32 g_CrcTable[]; 12370b324cSopenharmony_ci 13370b324cSopenharmony_ci/* Call CrcGenerateTable one time before other CRC functions */ 14370b324cSopenharmony_civoid Z7_FASTCALL CrcGenerateTable(void); 15370b324cSopenharmony_ci 16370b324cSopenharmony_ci#define CRC_INIT_VAL 0xFFFFFFFF 17370b324cSopenharmony_ci#define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL) 18370b324cSopenharmony_ci#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 19370b324cSopenharmony_ci 20370b324cSopenharmony_ciUInt32 Z7_FASTCALL CrcUpdate(UInt32 crc, const void *data, size_t size); 21370b324cSopenharmony_ciUInt32 Z7_FASTCALL CrcCalc(const void *data, size_t size); 22370b324cSopenharmony_ci 23370b324cSopenharmony_citypedef UInt32 (Z7_FASTCALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table); 24370b324cSopenharmony_ci 25370b324cSopenharmony_ciEXTERN_C_END 26370b324cSopenharmony_ci 27370b324cSopenharmony_ci#endif 28