14 static inline uint32_t
osmo_rol32(uint32_t word,
unsigned int shift)
16 return (word << shift) | (word >> ((-shift) & 31));
61 #define OSMO_JHASH_MIX(a, b, c) \ 63 a -= c; a ^= osmo_rol32(c, 4); c += b; \ 64 b -= a; b ^= osmo_rol32(a, 6); a += c; \ 65 c -= b; c ^= osmo_rol32(b, 8); b += a; \ 66 a -= c; a ^= osmo_rol32(c, 16); c += b; \ 67 b -= a; b ^= osmo_rol32(a, 19); a += c; \ 68 c -= b; c ^= osmo_rol32(b, 4); b += a; \ 72 #define OSMO_JHASH_FINAL(a, b, c) \ 74 c ^= b; c -= osmo_rol32(b, 14); \ 75 a ^= c; a -= osmo_rol32(c, 11); \ 76 b ^= a; b -= osmo_rol32(a, 25); \ 77 c ^= b; c -= osmo_rol32(b, 16); \ 78 a ^= c; a -= osmo_rol32(c, 4); \ 79 b ^= a; b -= osmo_rol32(a, 14); \ 80 c ^= b; c -= osmo_rol32(b, 24); \ 84 #define JHASH_INITVAL 0xdeadbeef 96 static inline uint32_t
osmo_jhash(
const void *key, uint32_t length, uint32_t initval)
99 const uint8_t *k = key;
105 while (length > 12) {
116 case 12: c += (uint32_t)k[11]<<24;
117 case 11: c += (uint32_t)k[10]<<16;
118 case 10: c += (uint32_t)k[9]<<8;
120 case 8: b += (uint32_t)k[7]<<24;
121 case 7: b += (uint32_t)k[6]<<16;
122 case 6: b += (uint32_t)k[5]<<8;
124 case 4: a += (uint32_t)k[3]<<24;
125 case 3: a += (uint32_t)k[2]<<16;
126 case 2: a += (uint32_t)k[1]<<8;
143 static inline uint32_t
osmo_jhash2(
const uint32_t *k, uint32_t length, uint32_t initval)
struct osmo_unaligned_cpu32 __attribute__((__packed__))
static uint32_t osmo_get_unaligned_cpu32(const void *p)
Definition: jhash.h:27
uint32_t x
Definition: jhash.h:24
#define OSMO_JHASH_FINAL(a, b, c)
Definition: jhash.h:72
#define OSMO_JHASH_MIX(a, b, c)
Definition: jhash.h:61
static uint32_t osmo_jhash(const void *key, uint32_t length, uint32_t initval)
Definition: jhash.h:96
#define JHASH_INITVAL
Definition: jhash.h:84
static uint32_t osmo_rol32(uint32_t word, unsigned int shift)
rol32 - rotate a 32-bit value left : value to rotate : bits to roll
Definition: jhash.h:14
static uint32_t osmo_jhash2(const uint32_t *k, uint32_t length, uint32_t initval)
Definition: jhash.h:143
struct abis_rsl_common_hdr c