-
Notifications
You must be signed in to change notification settings - Fork 12
/
jody_hash32.h
50 lines (40 loc) · 1.1 KB
/
jody_hash32.h
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
/* Jody Bruchon's fast hashing function (headers)
* See jody_hash.c for license information */
/*
* ****** WARNING *******
*
* This has been modified to integrate with SMHasher. DO NOT USE in other
* projects. The proper source for jodyhash is available at:
* https://github.com/jbruchon/jodyhash
*
* ****** WARNING *******
*/
#ifndef JODY_HASH32_H
#define JODY_HASH32_H
#ifdef __cplusplus
extern "C" {
#endif
/* Required for uint64_t */
#include <stdint.h>
/* Width of a jody_hash. Changing this will also require
* changing the width of tail masks to match. */
#ifndef JODY_HASH32_WIDTH
#define JODY_HASH32_WIDTH 32
#endif
#if JODY_HASH32_WIDTH == 64
typedef uint64_t jodyhash32_t;
#endif
#if JODY_HASH32_WIDTH == 32
typedef uint32_t jodyhash32_t;
#endif
#if JODY_HASH32_WIDTH == 16
typedef uint16_t jodyhash32_t;
#endif
/* Version increments when algorithm changes incompatibly */
#define JODY_HASH32_VERSION 5
extern jodyhash32_t jody_block_hash32(const jodyhash32_t *data,
const jodyhash32_t start_hash, const size_t count);
#ifdef __cplusplus
}
#endif
#endif /* JODY_HASH32_H */