diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2021-12-27 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2022-03-18 15:35:13 +0500 |
commit | f19f813537c7aea1c20749c914e756b54a9c3cf5 (patch) | |
tree | 816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /C/LzHash.h | |
parent | 98e06a519b63b81986abe76d28887f6984a7732b (diff) | |
download | 7zip-f19f813537c7aea1c20749c914e756b54a9c3cf5.tar.gz 7zip-f19f813537c7aea1c20749c914e756b54a9c3cf5.tar.bz2 7zip-f19f813537c7aea1c20749c914e756b54a9c3cf5.zip |
'21.07'21.07
Diffstat (limited to 'C/LzHash.h')
-rw-r--r-- | C/LzHash.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/C/LzHash.h b/C/LzHash.h new file mode 100644 index 0000000..77b898c --- /dev/null +++ b/C/LzHash.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* LzHash.h -- HASH functions for LZ algorithms | ||
2 | 2019-10-30 : Igor Pavlov : Public domain */ | ||
3 | |||
4 | #ifndef __LZ_HASH_H | ||
5 | #define __LZ_HASH_H | ||
6 | |||
7 | /* | ||
8 | (kHash2Size >= (1 << 8)) : Required | ||
9 | (kHash3Size >= (1 << 16)) : Required | ||
10 | */ | ||
11 | |||
12 | #define kHash2Size (1 << 10) | ||
13 | #define kHash3Size (1 << 16) | ||
14 | // #define kHash4Size (1 << 20) | ||
15 | |||
16 | #define kFix3HashSize (kHash2Size) | ||
17 | #define kFix4HashSize (kHash2Size + kHash3Size) | ||
18 | // #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) | ||
19 | |||
20 | /* | ||
21 | We use up to 3 crc values for hash: | ||
22 | crc0 | ||
23 | crc1 << Shift_1 | ||
24 | crc2 << Shift_2 | ||
25 | (Shift_1 = 5) and (Shift_2 = 10) is good tradeoff. | ||
26 | Small values for Shift are not good for collision rate. | ||
27 | Big value for Shift_2 increases the minimum size | ||
28 | of hash table, that will be slow for small files. | ||
29 | */ | ||
30 | |||
31 | #define kLzHash_CrcShift_1 5 | ||
32 | #define kLzHash_CrcShift_2 10 | ||
33 | |||
34 | #endif | ||