Derive-C
Loading...
Searching...
No Matches
combine.h File Reference
#include <stddef.h>
#include <derive-c/core/namespace.h>

Go to the source code of this file.

Functions

static DC_PUBLIC size_t dc_hash_combine (size_t seed, size_t h)

Function Documentation

◆ dc_hash_combine()

DC_PUBLIC size_t dc_hash_combine ( size_t seed,
size_t h )
inlinestatic
Examples
container/map.c, and container/set.c.

Definition at line 7 of file combine.h.

7 {
8 // 0x9e3779b97f4a7c15 is 64-bit fractional part of the golden ratio;
9 // “+ (seed<<6) + (seed>>2)” mixes seed’s bits
10 return seed ^ (h + 0x9e3779b97f4a7c15ULL + (seed << 6) + (seed >> 2));
11}