7 #ifdef JEMALLOC_H_TYPES
11 #ifdef JEMALLOC_H_STRUCTS
15 #ifdef JEMALLOC_H_EXTERNS
19 #ifdef JEMALLOC_H_INLINES
21 #ifndef JEMALLOC_ENABLE_INLINE
27 void hash(
const void *key,
size_t len,
const uint32_t seed,
31 #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_HASH_C_))
38 return (x << r) | (x >> (32 - r));
44 return (x << r) | (x >> (64 - r));
79 k *=
QU(0xff51afd7ed558ccdLLU);
81 k *=
QU(0xc4ceb9fe1a85ec53LLU);
91 const int nblocks = len / 4;
103 for (i = -nblocks; i; i++) {
112 h1 = h1*5 + 0xe6546b64;
123 case 3: k1 ^= tail[2] << 16;
124 case 2: k1 ^= tail[1] << 8;
125 case 1: k1 ^= tail[0]; k1 *= c1; k1 =
hash_rotl_32(k1, 15);
143 const int nblocks = len / 16;
160 for (i = -nblocks; i; i++) {
166 k1 *= c1; k1 =
hash_rotl_32(k1, 15); k1 *= c2; h1 ^= k1;
169 h1 = h1*5 + 0x561ccd1b;
171 k2 *= c2; k2 =
hash_rotl_32(k2, 16); k2 *= c3; h2 ^= k2;
174 h2 = h2*5 + 0x0bcaa747;
176 k3 *= c3; k3 =
hash_rotl_32(k3, 17); k3 *= c4; h3 ^= k3;
179 h3 = h3*5 + 0x96cd1c35;
181 k4 *= c4; k4 =
hash_rotl_32(k4, 18); k4 *= c1; h4 ^= k4;
184 h4 = h4*5 + 0x32ac3b17;
197 case 15: k4 ^= tail[14] << 16;
198 case 14: k4 ^= tail[13] << 8;
199 case 13: k4 ^= tail[12] << 0;
200 k4 *= c4; k4 =
hash_rotl_32(k4, 18); k4 *= c1; h4 ^= k4;
202 case 12: k3 ^= tail[11] << 24;
203 case 11: k3 ^= tail[10] << 16;
204 case 10: k3 ^= tail[ 9] << 8;
205 case 9: k3 ^= tail[ 8] << 0;
206 k3 *= c3; k3 =
hash_rotl_32(k3, 17); k3 *= c4; h3 ^= k3;
208 case 8: k2 ^= tail[ 7] << 24;
209 case 7: k2 ^= tail[ 6] << 16;
210 case 6: k2 ^= tail[ 5] << 8;
211 case 5: k2 ^= tail[ 4] << 0;
212 k2 *= c2; k2 =
hash_rotl_32(k2, 16); k2 *= c3; h2 ^= k2;
214 case 4: k1 ^= tail[ 3] << 24;
215 case 3: k1 ^= tail[ 2] << 16;
216 case 2: k1 ^= tail[ 1] << 8;
217 case 1: k1 ^= tail[ 0] << 0;
218 k1 *= c1; k1 =
hash_rotl_32(k1, 15); k1 *= c2; h1 ^= k1;
223 h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;
225 h1 += h2; h1 += h3; h1 += h4;
226 h2 += h1; h3 += h1; h4 += h1;
233 h1 += h2; h1 += h3; h1 += h4;
234 h2 += h1; h3 += h1; h4 += h1;
236 r_out[0] = (((
uint64_t) h2) << 32) | h1;
237 r_out[1] = (((
uint64_t) h4) << 32) | h3;
245 const int nblocks = len / 16;
250 const uint64_t c1 =
QU(0x87c37b91114253d5LLU);
251 const uint64_t c2 =
QU(0x4cf5ad432745937fLLU);
258 for (i = 0; i < nblocks; i++) {
262 k1 *= c1; k1 =
hash_rotl_64(k1, 31); k1 *= c2; h1 ^= k1;
265 h1 = h1*5 + 0x52dce729;
267 k2 *= c2; k2 =
hash_rotl_64(k2, 33); k2 *= c1; h2 ^= k2;
270 h2 = h2*5 + 0x38495ab5;
281 case 15: k2 ^= ((
uint64_t)(tail[14])) << 48;
282 case 14: k2 ^= ((
uint64_t)(tail[13])) << 40;
283 case 13: k2 ^= ((
uint64_t)(tail[12])) << 32;
284 case 12: k2 ^= ((
uint64_t)(tail[11])) << 24;
285 case 11: k2 ^= ((
uint64_t)(tail[10])) << 16;
286 case 10: k2 ^= ((
uint64_t)(tail[ 9])) << 8;
287 case 9: k2 ^= ((
uint64_t)(tail[ 8])) << 0;
288 k2 *= c2; k2 =
hash_rotl_64(k2, 33); k2 *= c1; h2 ^= k2;
290 case 8: k1 ^= ((
uint64_t)(tail[ 7])) << 56;
291 case 7: k1 ^= ((
uint64_t)(tail[ 6])) << 48;
292 case 6: k1 ^= ((
uint64_t)(tail[ 5])) << 40;
293 case 5: k1 ^= ((
uint64_t)(tail[ 4])) << 32;
294 case 4: k1 ^= ((
uint64_t)(tail[ 3])) << 24;
295 case 3: k1 ^= ((
uint64_t)(tail[ 2])) << 16;
296 case 2: k1 ^= ((
uint64_t)(tail[ 1])) << 8;
297 case 1: k1 ^= ((
uint64_t)(tail[ 0])) << 0;
298 k1 *= c1; k1 =
hash_rotl_64(k1, 31); k1 *= c2; h1 ^= k1;
303 h1 ^= len; h2 ^= len;
321 hash(
const void *key,
size_t len,
const uint32_t seed,
size_t r_hash[2])
323 #if (LG_SIZEOF_PTR == 3 && !defined(JEMALLOC_BIG_ENDIAN))
328 r_hash[0] = (size_t)hashes[0];
329 r_hash[1] = (size_t)hashes[1];
#define hash_get_block_32
Definition: private_namespace.h:189
#define JEMALLOC_INLINE
Definition: jemalloc_internal.h:259
#define UNUSED
Definition: jemalloc_internal.h:75
#define hash
Definition: private_namespace.h:186
#define QU(q)
Definition: jemalloc_internal.h:235
#define hash_x86_128
Definition: private_namespace.h:194
#define hash_rotl_32
Definition: private_namespace.h:191
unsigned int uint32_t
Definition: stdint.h:80
#define hash_fmix_64
Definition: private_namespace.h:188
unsigned __int64 uint64_t
Definition: stdint.h:90
#define hash_x64_128
Definition: private_namespace.h:193
unsigned char uint8_t
Definition: stdint.h:78
signed char int8_t
Definition: stdint.h:75
#define hash_rotl_64
Definition: private_namespace.h:192
#define hash_get_block_64
Definition: private_namespace.h:190
G3D::int16 x
Definition: Vector2int16.h:37
#define hash_fmix_32
Definition: private_namespace.h:187
#define hash_x86_32
Definition: private_namespace.h:195