~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to src/lib/lib7z/LzHash.h

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* LzHash.h -- HASH functions for LZ algorithms
 
2
2009-02-07 : Igor Pavlov : Public domain */
 
3
 
 
4
#ifndef __LZ_HASH_H
 
5
#define __LZ_HASH_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