libosmocore 1.13.1.1-afb4 Osmocom core library

Data Structures | Macros | Functions | Variables
jhash.h File Reference
`#include <osmocom/core/bit32gen.h>`

Go to the source code of this file.

## Data Structures
struct | osmo_unaligned_cpu32

## Macros
#define | OSMO_JHASH_MIX(a, b, c)
#define | OSMO_JHASH_FINAL(a, b, c)
#define | JHASH_INITVAL 0xdeadbeef

## Functions
static uint32_t | osmo_rol32 (uint32_t word, unsigned int shift)
| rol32 - rotate a 32-bit value left @word: value to rotate @shift: bits to roll More...
struct osmo_unaligned_cpu32 | __attribute__ ((__packed__))
static uint32_t | osmo_get_unaligned_cpu32 (const void *p)
static uint32_t | osmo_jhash (const void *key, uint32_t length, uint32_t initval)
static uint32_t | osmo_jhash2 (const uint32_t *k, uint32_t length, uint32_t initval)

## Variables
uint32_t | x

## Macro Definition Documentation

## ◆ JHASH_INITVAL

#define JHASH_INITVAL 0xdeadbeef

## ◆ OSMO_JHASH_FINAL

#define OSMO_JHASH_FINAL | ( |  | a,
|  |  | b,
|  |  | c
| ) |  |

Value:
{ \
c ^= b; c -= osmo_rol32(b, 14); \
a ^= c; a -= osmo_rol32(c, 11); \
b ^= a; b -= osmo_rol32(a, 25); \
c ^= b; c -= osmo_rol32(b, 16); \
a ^= c; a -= osmo_rol32(c, 4); \
b ^= a; b -= osmo_rol32(a, 14); \
c ^= b; c -= osmo_rol32(b, 24); \
}
c
struct abis_rsl_common_hdr c
osmo_rol32
static uint32_t osmo_rol32(uint32_t word, unsigned int shift)
rol32 - rotate a 32-bit value left @word: value to rotate @shift: bits to roll
Definition: jhash.h:14

## ◆ OSMO_JHASH_MIX

#define OSMO_JHASH_MIX | ( |  | a,
|  |  | b,
|  |  | c
| ) |  |

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

## Function Documentation

## ◆ __attribute__()

struct osmo_unaligned_cpu32 __attribute__ | ( | (__packed__) |  | ) |

## ◆ osmo_get_unaligned_cpu32()

static uint32_t osmo_get_unaligned_cpu32 | ( | const void * | p | ) |
| inline static

References osmo_unaligned_cpu32::x.

Referenced by osmo_jhash().

## ◆ osmo_jhash()

static uint32_t osmo_jhash | ( | const void * | key,
|  | uint32_t | length,
|  | uint32_t | initval
| ) |  |
| inline static

References c, JHASH_INITVAL, k, length, osmo_get_unaligned_cpu32(), OSMO_JHASH_FINAL, and OSMO_JHASH_MIX.

## ◆ osmo_jhash2()

static uint32_t osmo_jhash2 | ( | const uint32_t * | k,
|  | uint32_t | length,
|  | uint32_t | initval
| ) |  |
| inline static

References c, JHASH_INITVAL, k, length, OSMO_JHASH_FINAL, and OSMO_JHASH_MIX.

## ◆ osmo_rol32()

static uint32_t osmo_rol32 | ( | uint32_t | word,
|  | unsigned int | shift
| ) |  |
| inline static

rol32 - rotate a 32-bit value left @word: value to rotate @shift: bits to roll

## Variable Documentation

## ◆ x

uint32_t x

Referenced by __attribute__(), leading_bits(), osmo_base64_decode(), osmo_bit_reversal(), osmo_constant_time_cmp(), osmo_isqrt32(), osmo_revbytebits_32(), osmo_revbytebits_8(), osmo_store16be(), osmo_store16be_ext(), osmo_store16le(), osmo_store16le_ext(), osmo_store32be(), osmo_store32be_ext(), osmo_store32le(), osmo_store32le_ext(), osmo_store64be(), osmo_store64be_ext(), osmo_store64le(), and osmo_store64le_ext().