1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync/* 7zCrc.h -- CRC32 calculation
2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync2009-11-21 : Igor Pavlov : Public domain */
3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef __7Z_CRC_H
5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define __7Z_CRC_H
6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "Types.h"
8baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
9baa3858d3f5d128a5c8466b700098109edcad5f2repo syncEXTERN_C_BEGIN
10baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
11baa3858d3f5d128a5c8466b700098109edcad5f2repo syncextern UInt32 g_CrcTable[];
12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync/* Call CrcGenerateTable one time before other CRC functions */
14baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid MY_FAST_CALL CrcGenerateTable(void);
15baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
16baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define CRC_INIT_VAL 0xFFFFFFFF
17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL)
18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
20baa3858d3f5d128a5c8466b700098109edcad5f2repo syncUInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size);
21baa3858d3f5d128a5c8466b700098109edcad5f2repo syncUInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size);
22baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
23baa3858d3f5d128a5c8466b700098109edcad5f2repo syncEXTERN_C_END
24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif
26