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