FreeBSD kernel libkern code
jenkins_hash.c File Reference
#include <sys/hash.h>
#include <machine/endian.h>
Include dependency graph for jenkins_hash.c:

Go to the source code of this file.

Macros

#define rot(x, k)   (((x)<<(k)) | ((x)>>(32-(k))))
 
#define mix(a, b, c)
 
#define final(a, b, c)
 

Functions

uint32_t jenkins_hash32 (const uint32_t *k, size_t length, uint32_t initval)
 
uint32_t jenkins_hash (const void *key, size_t length, uint32_t initval)
 

Macro Definition Documentation

◆ final

#define final (   a,
  b,
  c 
)
Value:
{ \
c ^= b; c -= rot(b,14); \
a ^= c; a -= rot(c,11); \
b ^= a; b -= rot(a,25); \
c ^= b; c -= rot(b,16); \
a ^= c; a -= rot(c,4); \
b ^= a; b -= rot(a,14); \
c ^= b; c -= rot(b,24); \
}
int c
#define rot(x, k)
Definition: jenkins_hash.c:45

Definition at line 126 of file jenkins_hash.c.

◆ mix

#define mix (   a,
  b,
  c 
)
Value:
{ \
a -= c; a ^= rot(c, 4); c += b; \
b -= a; b ^= rot(a, 6); a += c; \
c -= b; c ^= rot(b, 8); b += a; \
a -= c; a ^= rot(c,16); c += b; \
b -= a; b ^= rot(a,19); a += c; \
c -= b; c ^= rot(b, 4); b += a; \
}

Definition at line 91 of file jenkins_hash.c.

◆ rot

#define rot (   x,
 
)    (((x)<<(k)) | ((x)>>(32-(k))))

Definition at line 45 of file jenkins_hash.c.

Function Documentation

◆ jenkins_hash()

uint32_t jenkins_hash ( const void *  key,
size_t  length,
uint32_t  initval 
)

Definition at line 213 of file jenkins_hash.c.

References c, and mix.

◆ jenkins_hash32()

uint32_t jenkins_hash32 ( const uint32_t *  k,
size_t  length,
uint32_t  initval 
)

Definition at line 150 of file jenkins_hash.c.

References c, and mix.