2013-10-08 15:07:03 +08:00
|
|
|
/* LzHash.h -- HASH functions for LZ algorithms
|
2022-08-29 14:23:38 +08:00
|
|
|
2019-10-30 : Igor Pavlov : Public domain */
|
2013-10-08 15:07:03 +08:00
|
|
|
|
|
|
|
#ifndef __LZ_HASH_H
|
|
|
|
#define __LZ_HASH_H
|
|
|
|
|
2022-08-29 14:23:38 +08:00
|
|
|
/*
|
|
|
|
(kHash2Size >= (1 << 8)) : Required
|
|
|
|
(kHash3Size >= (1 << 16)) : Required
|
|
|
|
*/
|
|
|
|
|
2013-10-08 15:07:03 +08:00
|
|
|
#define kHash2Size (1 << 10)
|
|
|
|
#define kHash3Size (1 << 16)
|
2022-08-29 14:23:38 +08:00
|
|
|
// #define kHash4Size (1 << 20)
|
2013-10-08 15:07:03 +08:00
|
|
|
|
|
|
|
#define kFix3HashSize (kHash2Size)
|
|
|
|
#define kFix4HashSize (kHash2Size + kHash3Size)
|
2022-08-29 14:23:38 +08:00
|
|
|
// #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
|
|
|
|
|
|
|
|
/*
|
|
|
|
We use up to 3 crc values for hash:
|
|
|
|
crc0
|
|
|
|
crc1 << Shift_1
|
|
|
|
crc2 << Shift_2
|
|
|
|
(Shift_1 = 5) and (Shift_2 = 10) is good tradeoff.
|
|
|
|
Small values for Shift are not good for collision rate.
|
|
|
|
Big value for Shift_2 increases the minimum size
|
|
|
|
of hash table, that will be slow for small files.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define kLzHash_CrcShift_1 5
|
|
|
|
#define kLzHash_CrcShift_2 10
|
2013-10-08 15:07:03 +08:00
|
|
|
|
|
|
|
#endif
|