Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: third_party/lzma_sdk/LzHash.h

Issue 1700453002: Update lzma_sdk sources to 15.14. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium modifications Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/lzma_sdk/LzFind.c ('k') | third_party/lzma_sdk/Lzma2Dec.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* LzHash.h -- HASH functions for LZ algorithms 1 /* LzHash.h -- HASH functions for LZ algorithms
2 2009-02-07 : Igor Pavlov : Public domain */ 2 2015-04-12 : Igor Pavlov : Public domain */
3 3
4 #ifndef __LZ_HASH_H 4 #ifndef __LZ_HASH_H
5 #define __LZ_HASH_H 5 #define __LZ_HASH_H
6 6
7 #define kHash2Size (1 << 10) 7 #define kHash2Size (1 << 10)
8 #define kHash3Size (1 << 16) 8 #define kHash3Size (1 << 16)
9 #define kHash4Size (1 << 20) 9 #define kHash4Size (1 << 20)
10 10
11 #define kFix3HashSize (kHash2Size) 11 #define kFix3HashSize (kHash2Size)
12 #define kFix4HashSize (kHash2Size + kHash3Size) 12 #define kFix4HashSize (kHash2Size + kHash3Size)
13 #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) 13 #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
14 14
15 #define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8); 15 #define HASH2_CALC hv = cur[0] | ((UInt32)cur[1] << 8);
16 16
17 #define HASH3_CALC { \ 17 #define HASH3_CALC { \
18 UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 18 UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
19 hash2Value = temp & (kHash2Size - 1); \ 19 h2 = temp & (kHash2Size - 1); \
20 hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } 20 hv = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
21 21
22 #define HASH4_CALC { \ 22 #define HASH4_CALC { \
23 UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 23 UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
24 hash2Value = temp & (kHash2Size - 1); \ 24 h2 = temp & (kHash2Size - 1); \
25 hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ 25 temp ^= ((UInt32)cur[2] << 8); \
26 hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMa sk; } 26 h3 = temp & (kHash3Size - 1); \
27 hv = (temp ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
27 28
28 #define HASH5_CALC { \ 29 #define HASH5_CALC { \
29 UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 30 UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
30 hash2Value = temp & (kHash2Size - 1); \ 31 h2 = temp & (kHash2Size - 1); \
31 hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ 32 temp ^= ((UInt32)cur[2] << 8); \
32 hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \ 33 h3 = temp & (kHash3Size - 1); \
33 hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \ 34 temp ^= (p->crc[cur[3]] << 5); \
34 hash4Value &= (kHash4Size - 1); } 35 h4 = temp & (kHash4Size - 1); \
36 hv = (temp ^ (p->crc[cur[4]] << 3)) & p->hashMask; }
35 37
36 /* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[ cur[2]]) & 0xFFFF; */ 38 /* #define HASH_ZIP_CALC hv = ((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; 39 #define HASH_ZIP_CALC hv = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
38 40
39 41
40 #define MT_HASH2_CALC \ 42 #define MT_HASH2_CALC \
41 hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); 43 h2 = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
42 44
43 #define MT_HASH3_CALC { \ 45 #define MT_HASH3_CALC { \
44 UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 46 UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
45 hash2Value = temp & (kHash2Size - 1); \ 47 h2 = temp & (kHash2Size - 1); \
46 hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } 48 h3 = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
47 49
48 #define MT_HASH4_CALC { \ 50 #define MT_HASH4_CALC { \
49 UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 51 UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
50 hash2Value = temp & (kHash2Size - 1); \ 52 h2 = temp & (kHash2Size - 1); \
51 hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ 53 temp ^= ((UInt32)cur[2] << 8); \
52 hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4S ize - 1); } 54 h3 = temp & (kHash3Size - 1); \
55 h4 = (temp ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
53 56
54 #endif 57 #endif
OLDNEW
« no previous file with comments | « third_party/lzma_sdk/LzFind.c ('k') | third_party/lzma_sdk/Lzma2Dec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698