mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-18 04:10:57 +01:00
initial commit
This commit is contained in:
25
libpcp/jenhash.h
Normal file
25
libpcp/jenhash.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef _HAVE_JENHASH_H
|
||||
#define _HAVE_JENHASH_H
|
||||
|
||||
// Bob Jenkins 32bit hash function
|
||||
// via: http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx
|
||||
|
||||
#define jen_mix(a,b,c) \
|
||||
{ \
|
||||
a -= b; a -= c; a ^= ( c >> 13 ); \
|
||||
b -= c; b -= a; b ^= ( a << 8 ); \
|
||||
c -= a; c -= b; c ^= ( b >> 13 ); \
|
||||
a -= b; a -= c; a ^= ( c >> 12 ); \
|
||||
b -= c; b -= a; b ^= ( a << 16 ); \
|
||||
c -= a; c -= b; c ^= ( b >> 5 ); \
|
||||
a -= b; a -= c; a ^= ( c >> 3 ); \
|
||||
b -= c; b -= a; b ^= ( a << 10 ); \
|
||||
c -= a; c -= b; c ^= ( b >> 15 ); \
|
||||
}
|
||||
|
||||
#define JEN_PSALT 0xD9A03
|
||||
#define JEN_SSALT 0xC503B
|
||||
|
||||
unsigned jen_hash ( unsigned char *k, unsigned length, unsigned initval );
|
||||
|
||||
#endif // _HAVE_JENHASH_H
|
||||
Reference in New Issue
Block a user