Line data Source code
1 : /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2 :
3 : #pragma once
4 :
5 : #include <inttypes.h>
6 : #include <sys/types.h>
7 :
8 : #include "macro.h"
9 :
10 : uint32_t jenkins_hashword(const uint32_t *k, size_t length, uint32_t initval) _pure_;
11 : void jenkins_hashword2(const uint32_t *k, size_t length, uint32_t *pc, uint32_t *pb);
12 :
13 : uint32_t jenkins_hashlittle(const void *key, size_t length, uint32_t initval) _pure_;
14 : void jenkins_hashlittle2(const void *key, size_t length, uint32_t *pc, uint32_t *pb);
15 :
16 : uint32_t jenkins_hashbig(const void *key, size_t length, uint32_t initval) _pure_;
17 :
18 170724 : static inline uint64_t hash64(const void *data, size_t length) {
19 170724 : uint32_t a = 0, b = 0;
20 :
21 170724 : jenkins_hashlittle2(data, length, &a, &b);
22 :
23 170724 : return ((uint64_t) a << 32ULL) | (uint64_t) b;
24 : }
|