ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/liblzf/lzf_c.c
(Generate patch)

Comparing liblzf/lzf_c.c (file contents):
Revision 1.1 by root, Sun Jun 9 22:41:34 2002 UTC vs.
Revision 1.2 by root, Thu Sep 5 03:31:00 2002 UTC

36 * the hashing function might seem strange, just believe me 36 * the hashing function might seem strange, just believe me
37 * it works ;) 37 * it works ;)
38 */ 38 */
39#define FRST(p) (((p[0]) << 8) + p[1]) 39#define FRST(p) (((p[0]) << 8) + p[1])
40#define NEXT(v,p) (((v) << 8) + p[2]) 40#define NEXT(v,p) (((v) << 8) + p[2])
41#define IDX(h) ((((h ^ (h << 4)) >> (3*8 - HLOG)) + h*3) & (HSIZE - 1)) 41#define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) + h*3) & (HSIZE - 1))
42/* 42/*
43 * IDX works because it is very similar to a multiplicative hash, e.g. 43 * IDX works because it is very similar to a multiplicative hash, e.g.
44 * (h * 57321 >> (3*8 - HLOG)) 44 * (h * 57321 >> (3*8 - HLOG))
45 * the next one is also quite good, albeit slow ;) 45 * the next one is also quite good, albeit slow ;)
46 * (int)(cos(h & 0xffffff) * 1e6) 46 * (int)(cos(h & 0xffffff) * 1e6)
47 */ 47 */
48 48
49#if 0 49#if 0
50/* original lzv-like hash function */ 50/* original lzv-like hash function */
51# define FRST(p) (p[0] << 5) ^ p[1] 51# define FRST(p) (p[0] << 5) ^ p[1]
52# define NEXT(v,p) (v << 5) ^ p[2] 52# define NEXT(v,p) ((v) << 5) ^ p[2]
53# define IDX(h) (h) & (HSIZE - 1) 53# define IDX(h) ((h) & (HSIZE - 1))
54#endif 54#endif
55 55
56#define MAX_LIT (1 << 5) 56#define MAX_LIT (1 << 5)
57#define MAX_OFF (1 << 13) 57#define MAX_OFF (1 << 13)
58#define MAX_REF ((1 << 8) + (1 << 3)) 58#define MAX_REF ((1 << 8) + (1 << 3))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines