libosmocore 1.14.2.5-c055.202609101800
Osmocom core library
Loading...
Searching...
No Matches
hash.h File Reference
#include <osmocom/core/log2.h>
#include <limits.h>

Go to the source code of this file.

Macros

#define BITS_PER_LONG   64
#define hash_long(val, bits)
#define GOLDEN_RATIO_PRIME   GOLDEN_RATIO_64
#define GOLDEN_RATIO_32   0x61C88647
#define GOLDEN_RATIO_64   0x61C8864680B583EBull
#define __hash_32   __hash_32_generic
#define hash_32   hash_32_generic
#define hash_64   hash_64_generic

Functions

static uint32_t __hash_32_generic (uint32_t val)
static uint32_t hash_32_generic (uint32_t val, unsigned int bits)
static __attribute__ ((always_inline)) uint32_t hash_64_generic(uint64_t val
static uint32_t hash_ptr (const void *ptr, unsigned int bits)
static uint32_t hash32_ptr (const void *ptr)

Variables

static unsigned int bits

Macro Definition Documentation

◆ __hash_32

#define __hash_32   __hash_32_generic

Referenced by __attribute__(), and hash_32_generic().

◆ BITS_PER_LONG

#define BITS_PER_LONG   64

◆ GOLDEN_RATIO_32

#define GOLDEN_RATIO_32   0x61C88647

Referenced by __hash_32_generic().

◆ GOLDEN_RATIO_64

#define GOLDEN_RATIO_64   0x61C8864680B583EBull

Referenced by __attribute__().

◆ GOLDEN_RATIO_PRIME

#define GOLDEN_RATIO_PRIME   GOLDEN_RATIO_64

◆ hash_32

#define hash_32   hash_32_generic

Referenced by __attribute__().

◆ hash_64

#define hash_64   hash_64_generic

◆ hash_long

#define hash_long ( val,
bits )
Value:
static unsigned int bits
Definition hash.h:77
#define hash_64
Definition hash.h:74

Referenced by hash_ptr().

Function Documentation

◆ __attribute__()

__attribute__ ( (always_inline) )
inlinestatic

References __hash_32, bits, GOLDEN_RATIO_64, and hash_32.

◆ __hash_32_generic()

uint32_t __hash_32_generic ( uint32_t val)
inlinestatic

References GOLDEN_RATIO_32.

◆ hash32_ptr()

uint32_t hash32_ptr ( const void * ptr)
inlinestatic

◆ hash_32_generic()

uint32_t hash_32_generic ( uint32_t val,
unsigned int bits )
inlinestatic

References __hash_32, and bits.

◆ hash_ptr()

uint32_t hash_ptr ( const void * ptr,
unsigned int bits )
inlinestatic

References bits, and hash_long.

Variable Documentation

◆ bits

unsigned int bits
Initial value:
{
return val * GOLDEN_RATIO_64 >> (64 - bits)
#define GOLDEN_RATIO_64
Definition hash.h:46

Referenced by __attribute__(), bitvec_add_array(), bitvec_set_bits(), hash_32_generic(), hash_ptr(), osmo_ubit_dump(), and osmo_ubit_dump_buf().