-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathjenkins-hash.h
More file actions
59 lines (49 loc) · 1.33 KB
/
jenkins-hash.h
File metadata and controls
59 lines (49 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright (C) 2013 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#ifndef __JENKINS_HASH__
#define __JENKINS_HASH__
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <stdint.h>
/* This header declares and exports Bob Jenkins hash functions define in lookup3.c.
* lookup3.c was downloaded from: http://www.burtleburtle.net/bob/c/lookup3.c
* See: http://www.burtleburtle.net/bob/hash/doobs.html for more information.
*
* Export other functions in that library as necessary.
*/
void bj_hashlittle2(
const void *key, /* the key to hash */
size_t length, /* length of the key */
uint32_t *pc, /* IN: primary initval, OUT: primary hash */
uint32_t *pb); /* IN: secondary initval, OUT: secondary hash */
/* bj_hashsize(shift) gives a hash table size that is a power of 2, good for bj_hashlittle2.
* shift values are:
*
* 1024 -> 10
* 4096 -> 12
* 16384 -> 14
* 65536 -> 16
* 262144 -> 18
* 1048576 -> 20
*/
#define bj_hashsize(n) ((uint32_t)1<<(n))
/* bj_hashmask(n) gives a mask reasonable for returning a hash between 0 and the hashtable size.
*/
#define bj_hashmask(n) (bj_hashsize(n)-1)
#ifdef __cplusplus
}
#endif
#endif
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ts=8 sts=4 sw=4 expandtab
*/