Revision: | 1.1 |
Committed: | Tue Feb 24 20:13:57 2009 UTC (16 years, 2 months ago) by loizides |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, V07-05-00, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, ConvRejection-10-06-09, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010, Mit_009c, Mit_009b, Mit_009a, Mit_009, Mit_008, Mit_008pre2, Mit_008pre1, HEAD |
Branch point for: | Mit_025c_branch |
Log Message: | Added lzma |
# | User | Rev | Content |
---|---|---|---|
1 | loizides | 1.1 | /* LzHash.h -- HASH functions for LZ algorithms |
2 | 2008-10-04 : Igor Pavlov : Public domain */ | ||
3 | |||
4 | #ifndef __LZHASH_H | ||
5 | #define __LZHASH_H | ||
6 | |||
7 | #define kHash2Size (1 << 10) | ||
8 | #define kHash3Size (1 << 16) | ||
9 | #define kHash4Size (1 << 20) | ||
10 | |||
11 | #define kFix3HashSize (kHash2Size) | ||
12 | #define kFix4HashSize (kHash2Size + kHash3Size) | ||
13 | #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) | ||
14 | |||
15 | #define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8); | ||
16 | |||
17 | #define HASH3_CALC { \ | ||
18 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ | ||
19 | hash2Value = temp & (kHash2Size - 1); \ | ||
20 | hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } | ||
21 | |||
22 | #define HASH4_CALC { \ | ||
23 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ | ||
24 | hash2Value = temp & (kHash2Size - 1); \ | ||
25 | hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ | ||
26 | hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; } | ||
27 | |||
28 | #define HASH5_CALC { \ | ||
29 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ | ||
30 | hash2Value = temp & (kHash2Size - 1); \ | ||
31 | hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ | ||
32 | hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \ | ||
33 | hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \ | ||
34 | hash4Value &= (kHash4Size - 1); } | ||
35 | |||
36 | /* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ | ||
37 | #define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; | ||
38 | |||
39 | |||
40 | #define MT_HASH2_CALC \ | ||
41 | hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); | ||
42 | |||
43 | #define MT_HASH3_CALC { \ | ||
44 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ | ||
45 | hash2Value = temp & (kHash2Size - 1); \ | ||
46 | hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } | ||
47 | |||
48 | #define MT_HASH4_CALC { \ | ||
49 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ | ||
50 | hash2Value = temp & (kHash2Size - 1); \ | ||
51 | hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ | ||
52 | hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } | ||
53 | |||
54 | #endif |