… | |
… | |
48 | */ |
48 | */ |
49 | #ifndef FRST |
49 | #ifndef FRST |
50 | # define FRST(p) (((p[0]) << 8) | p[1]) |
50 | # define FRST(p) (((p[0]) << 8) | p[1]) |
51 | # define NEXT(v,p) (((v) << 8) | p[2]) |
51 | # define NEXT(v,p) (((v) << 8) | p[2]) |
52 | # define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1)) |
52 | # define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1)) |
53 | //# define IDX(h) ((ip[0] * 121 ^ ip[1] * 33 ^ ip[2] * 1) & (HSIZE-1)) |
53 | /*# define IDX(h) ((ip[0] * 121 ^ ip[1] * 33 ^ ip[2] * 1) & (HSIZE-1))*/ |
54 | #endif |
54 | #endif |
55 | /* |
55 | /* |
56 | * IDX works because it is very similar to a multiplicative hash, e.g. |
56 | * IDX works because it is very similar to a multiplicative hash, e.g. |
57 | * ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1)) |
57 | * ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1)) |
58 | * the latter is also quite fast on newer CPUs, and compresses similarly. |
58 | * the latter is also quite fast on newer CPUs, and compresses similarly. |