1 #ifndef JENKINSHASH_INCLUDED 2 #define JENKINSHASH_INCLUDED 4 #if defined __has_cpp_attribute 5 #if __has_cpp_attribute(fallthrough) 6 #define MARLIN_FALLTHROUGH [[fallthrough]] 8 #define MARLIN_FALLTHROUGH 11 #define MARLIN_FALLTHROUGH 24 #define hashsize(n) ( 1U << (n) ) 25 #define hashmask(n) ( hashsize ( n ) - 1 ) 56 a -= b; a -= c; a ^= (c>>13); \ 57 b -= c; b -= a; b ^= (a<<8); \ 58 c -= a; c -= b; c ^= (b>>13); \ 59 a -= b; a -= c; a ^= (c>>12); \ 60 b -= c; b -= a; b ^= (a<<16); \ 61 c -= a; c -= b; c ^= (b>>5); \ 62 a -= b; a -= c; a ^= (c>>3); \ 63 b -= c; b -= a; b ^= (a<<10); \ 64 c -= a; c -= b; c ^= (b>>15); \ 94 inline unsigned jenkins_hash (
unsigned char *k,
unsigned length,
unsigned initval )
98 unsigned len = length;
102 while ( len >= 12 ) {
103 a += ( k[0] + ( (unsigned)k[1] << 8 )
104 + ( (unsigned)k[2] << 16 )
105 + ( (unsigned)k[3] << 24 ) );
106 b += ( k[4] + ( (unsigned)k[5] << 8 )
107 + ( (unsigned)k[6] << 16 )
108 + ( (unsigned)k[7] << 24 ) );
109 c += ( k[8] + ( (unsigned)k[9] << 8 )
110 + ( (unsigned)k[10] << 16 )
111 + ( (unsigned)k[11] << 24 ) );
#define MARLIN_FALLTHROUGH
unsigned jenkins_hash(unsigned char *k, unsigned length, unsigned initval)