Debian Codegraph @

src/ulid_transform/splitmix64.hh

raw symbols SCIP
1 #ifndef ULID_SPLITMIX64_HH
2 #define ULID_SPLITMIX64_HH
3
4 #include <cstdint>
5
6 namespace ulid {
7
8 /**
9 * SplitMix64 is a fast, small-state PRNG suitable for non-cryptographic use.
10 */
11 struct SplitMix64 {
12 uint64_t state;
13
14 explicit SplitMix64(uint64_t seed)
15 : state(seed)
16 {
17 }
18
19 uint64_t operator()()
20 {
21 uint64_t z = (state += 0x9e3779b97f4a7c15ULL);
22 z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9ULL;
23 z = (z ^ (z >> 27)) * 0x94d049bb133111ebULL;
24 return z ^ (z >> 31);
25 }
26 };
27
28 }
29
30 #endif // ULID_SPLITMIX64_HH