1 #ifndef JENKINSHASH_INCLUDED
2 #define JENKINSHASH_INCLUDED
14 #define hashsize(n) ( 1U << (n) )
15 #define hashmask(n) ( hashsize ( n ) - 1 )
46 a -= b; a -= c; a ^= (c>>13); \
47 b -= c; b -= a; b ^= (a<<8); \
48 c -= a; c -= b; c ^= (b>>13); \
49 a -= b; a -= c; a ^= (c>>12); \
50 b -= c; b -= a; b ^= (a<<16); \
51 c -= a; c -= b; c ^= (b>>5); \
52 a -= b; a -= c; a ^= (c>>3); \
53 b -= c; b -= a; b ^= (a<<10); \
54 c -= a; c -= b; c ^= (b>>15); \
84 unsigned jenkins_hash (
unsigned char *k,
unsigned length,
unsigned initval )
88 unsigned len = length;
93 a += ( k[0] + ( (unsigned)k[1] << 8 )
94 + ( (unsigned)k[2] << 16 )
95 + ( (unsigned)k[3] << 24 ) );
96 b += ( k[4] + ( (unsigned)k[5] << 8 )
97 + ( (unsigned)k[6] << 16 )
98 + ( (unsigned)k[7] << 24 ) );
99 c += ( k[8] + ( (unsigned)k[9] << 8 )
100 + ( (unsigned)k[10] << 16 )
101 + ( (unsigned)k[11] << 24 ) );
112 case 11: c += ( (unsigned)k[10] << 24 );
113 case 10: c += ( (unsigned)k[9] << 16 );
114 case 9 : c += ( (unsigned)k[8] << 8 );
116 case 8 : b += ( (unsigned)k[7] << 24 );
117 case 7 : b += ( (unsigned)k[6] << 16 );
118 case 6 : b += ( (unsigned)k[5] << 8 );
120 case 4 : a += ( (unsigned)k[3] << 24 );
121 case 3 : a += ( (unsigned)k[2] << 16 );
122 case 2 : a += ( (unsigned)k[1] << 8 );