DPDK  2.0.0
Macros | Functions
rte_jhash.h File Reference
#include <stdint.h>

Macros

#define RTE_JHASH_GOLDEN_RATIO   0x9e3779b9

Functions

static uint32_t rte_jhash (const void *key, uint32_t length, uint32_t initval)
static uint32_t rte_jhash2 (const uint32_t *k, uint32_t length, uint32_t initval)
static uint32_t rte_jhash_3words (uint32_t a, uint32_t b, uint32_t c, uint32_t initval)
static uint32_t rte_jhash_2words (uint32_t a, uint32_t b, uint32_t initval)
static uint32_t rte_jhash_1word (uint32_t a, uint32_t initval)

Detailed Description

jhash functions.

Macro Definition Documentation

#define RTE_JHASH_GOLDEN_RATIO   0x9e3779b9

The golden ratio: an arbitrary value.

Function Documentation

static uint32_t rte_jhash ( const void *  key,
uint32_t  length,
uint32_t  initval 
)
inlinestatic

The most generic version, hashes an arbitrary sequence of bytes. No alignment or length assumptions are made about the input key.

Parameters
keyKey to calculate hash of.
lengthLength of key in bytes.
initvalInitialising value of hash.
Returns
Calculated hash value.
static uint32_t rte_jhash2 ( const uint32_t *  k,
uint32_t  length,
uint32_t  initval 
)
inlinestatic

A special optimized version that handles 1 or more of uint32_ts. The length parameter here is the number of uint32_ts in the key.

Parameters
kKey to calculate hash of.
lengthLength of key in units of 4 bytes.
initvalInitialising value of hash.
Returns
Calculated hash value.
static uint32_t rte_jhash_1word ( uint32_t  a,
uint32_t  initval 
)
inlinestatic

A special ultra-optimized versions that knows it is hashing exactly 1 word.

Parameters
aWord to calcuate hash of.
initvalInitialising value of hash.
Returns
Calculated hash value.
static uint32_t rte_jhash_2words ( uint32_t  a,
uint32_t  b,
uint32_t  initval 
)
inlinestatic

A special ultra-optimized versions that knows it is hashing exactly 2 words.

Parameters
aFirst word to calcuate hash of.
bSecond word to calcuate hash of.
initvalInitialising value of hash.
Returns
Calculated hash value.
static uint32_t rte_jhash_3words ( uint32_t  a,
uint32_t  b,
uint32_t  c,
uint32_t  initval 
)
inlinestatic

A special ultra-optimized versions that knows it is hashing exactly 3 words.

Parameters
aFirst word to calcuate hash of.
bSecond word to calcuate hash of.
cThird word to calcuate hash of.
initvalInitialising value of hash.
Returns
Calculated hash value.