#include <stdint.h>
#include <string.h>
#include <limits.h>
#include <endian.h>
#include <cne_log.h>
Go to the source code of this file.
|
static void | cne_jhash_2hashes (const void *key, uint32_t length, uint32_t *pc, uint32_t *pb) |
|
static void | cne_jhash_32b_2hashes (const uint32_t *k, uint32_t length, uint32_t *pc, uint32_t *pb) |
|
static uint32_t | cne_jhash (const void *key, uint32_t length, uint32_t initval) |
|
static uint32_t | cne_jhash_32b (const uint32_t *k, uint32_t length, uint32_t initval) |
|
static uint32_t | cne_jhash_3words (uint32_t a, uint32_t b, uint32_t c, uint32_t initval) |
|
static uint32_t | cne_jhash_2words (uint32_t a, uint32_t b, uint32_t initval) |
|
static uint32_t | cne_jhash_1word (uint32_t a, uint32_t initval) |
|
jhash functions.
Definition in file cne_jhash.h.
◆ CNE_JHASH_GOLDEN_RATIO
#define CNE_JHASH_GOLDEN_RATIO 0xdeadbeef |
The golden ratio: an arbitrary value.
Definition at line 69 of file cne_jhash.h.
◆ cne_jhash_2hashes()
static void cne_jhash_2hashes |
( |
const void * |
key, |
|
|
uint32_t |
length, |
|
|
uint32_t * |
pc, |
|
|
uint32_t * |
pb |
|
) |
| |
|
inlinestatic |
Same as cne_jhash, but takes two seeds and return two uint32_ts. pc and pb must be non-null, and *pc and *pb must both be initialized with seeds. If you pass in (*pb)=0, the output (*pc) will be the same as the return value from cne_jhash.
- Parameters
-
key | Key to calculate hash of. |
length | Length of key in bytes. |
pc | IN: seed OUT: primary hash value. |
pb | IN: second seed OUT: secondary hash value. |
Definition at line 233 of file cne_jhash.h.
◆ cne_jhash_32b_2hashes()
static void cne_jhash_32b_2hashes |
( |
const uint32_t * |
k, |
|
|
uint32_t |
length, |
|
|
uint32_t * |
pc, |
|
|
uint32_t * |
pb |
|
) |
| |
|
inlinestatic |
Same as cne_jhash_32b, but takes two seeds and return two uint32_ts. pc and pb must be non-null, and *pc and *pb must both be initialized with seeds. If you pass in (*pb)=0, the output (*pc) will be the same as the return value from cne_jhash_32b.
- Parameters
-
k | Key to calculate hash of. |
length | Length of key in units of 4 bytes. |
pc | IN: seed OUT: primary hash value. |
pb | IN: second seed OUT: secondary hash value. |
Definition at line 254 of file cne_jhash.h.
◆ cne_jhash()
static uint32_t cne_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. For keys not aligned to four byte boundaries or a multiple of four bytes in length, the memory region just after may be read (but not used in the computation). This may cross a page boundary.
- Parameters
-
key | Key to calculate hash of. |
length | Length of key in bytes. |
initval | Initialising value of hash. |
- Returns
- Calculated hash value.
Definition at line 277 of file cne_jhash.h.
◆ cne_jhash_32b()
static uint32_t cne_jhash_32b |
( |
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
-
k | Key to calculate hash of. |
length | Length of key in units of 4 bytes. |
initval | Initialising value of hash. |
- Returns
- Calculated hash value.
Definition at line 300 of file cne_jhash.h.
◆ cne_jhash_3words()
static uint32_t cne_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
-
a | First word to calculate hash of. |
b | Second word to calculate hash of. |
c | Third word to calculate hash of. |
initval | Initialising value of hash. |
- Returns
- Calculated hash value.
Definition at line 337 of file cne_jhash.h.
◆ cne_jhash_2words()
static uint32_t cne_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
-
a | First word to calculate hash of. |
b | Second word to calculate hash of. |
initval | Initialising value of hash. |
- Returns
- Calculated hash value.
Definition at line 356 of file cne_jhash.h.
◆ cne_jhash_1word()
static uint32_t cne_jhash_1word |
( |
uint32_t |
a, |
|
|
uint32_t |
initval |
|
) |
| |
|
inlinestatic |
A special ultra-optimized versions that knows it is hashing exactly 1 word.
- Parameters
-
a | Word to calculate hash of. |
initval | Initialising value of hash. |
- Returns
- Calculated hash value.
Definition at line 373 of file cne_jhash.h.