]> git.proxmox.com Git - mirror_frr.git/blame - lib/jhash.h
Merge pull request #5778 from ton31337/fix/add_doc_for_ebgp_connected_route_check
[mirror_frr.git] / lib / jhash.h
CommitLineData
b9790b34 1/* jhash.h: Jenkins hash support.
2 *
3 * Copyright (C) 1996 Bob Jenkins (bob_jenkins@burtleburtle.net)
4 *
5 * http://burtleburtle.net/bob/hash/
6 *
7 * These are the credits from Bob's sources:
8 *
9 * lookup2.c, by Bob Jenkins, December 1996, Public Domain.
10 * hash(), hash2(), hash3, and mix() are externally useful functions.
11 * Routines to test the hash are included if SELF_TEST is defined.
12 * You can use this free for any purpose. It has no warranty.
13 *
14 * Copyright (C) 2003 David S. Miller (davem@redhat.com)
15 *
16 * I've modified Bob's hash to be useful in the Linux kernel, and
17 * any bugs present are surely my fault. -DaveM
18 */
19
20#ifndef _QUAGGA_JHASH_H
21#define _QUAGGA_JHASH_H
22
5e244469
RW
23#ifdef __cplusplus
24extern "C" {
25#endif
26
b9790b34 27/* The most generic version, hashes an arbitrary sequence
28 * of bytes. No alignment or length assumptions are made about
29 * the input key.
30 */
d7c0a89a 31extern uint32_t jhash(const void *key, uint32_t length, uint32_t initval);
b9790b34 32
d7c0a89a
QY
33/* A special optimized version that handles 1 or more of uint32_ts.
34 * The length parameter here is the number of uint32_ts in the key.
b9790b34 35 */
d7c0a89a 36extern uint32_t jhash2(const uint32_t *k, uint32_t length, uint32_t initval);
b9790b34 37
38/* A special ultra-optimized versions that knows they are hashing exactly
39 * 3, 2 or 1 word(s).
40 *
41 * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally
42 * done at the end is not done here.
43 */
d7c0a89a
QY
44extern uint32_t jhash_3words(uint32_t a, uint32_t b, uint32_t c,
45 uint32_t initval);
46extern uint32_t jhash_2words(uint32_t a, uint32_t b, uint32_t initval);
47extern uint32_t jhash_1word(uint32_t a, uint32_t initval);
b9790b34 48
5e244469
RW
49#ifdef __cplusplus
50}
51#endif
52
b9790b34 53#endif /* _QUAGGA_JHASH_H */