14 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
15template <
typename m
int,
size_t num_bases>
17 array<mint, num_bases> res;
18 for (
int i = 0; i < num_bases; i++) {
23template <
typename m
int,
size_t num_bases>
24constexpr array<mint, num_bases>
26 array<mint, num_bases> res;
27 for (
int i = 0; i < num_bases; i++) {
28 res[i] = bases[i].inv();
32template <
typename m
int,
size_t num_bases,
size_t CACHE>
33constexpr array<array<mint, CACHE>, num_bases>
35 array<array<mint, CACHE>, num_bases> res;
36 for (
int i = 0; i < num_bases; i++) {
38 for (
int j = 1; j < CACHE; j++) {
39 res[i][j] = res[i][j - 1] * bases[i];
46 static unsigned long long r =
47 chrono::high_resolution_clock::now().time_since_epoch().count();
48 constexpr unsigned long long z1 = 11995408973635179863ull;
49 if constexpr (internal::type_traits::is_broadly_integral_v<T>) {
50 return ((
unsigned long long)x ^ r) * z1;
51 }
else if constexpr (internal::type_traits::is_pair_v<T>) {
52 constexpr unsigned long long z2 = 10150724397891781847ull;
55 constexpr unsigned long long mod = (1ll << 61) - 1;
56 constexpr unsigned long long base = 950699498548472943ull;
57 unsigned long long m = 0;
60 unsigned __int128 r = (
unsigned __int128)m * base + (v & mod);
61 m = (r & mod) + (r >> 61);
Definition concepts.hpp:40
Definition hashing.hpp:10
constexpr array< mint, num_bases > gen_inverse(const array< mint, num_bases > &bases)
Definition hashing.hpp:25
unsigned long long hash_function(const T &x)
Definition hashing.hpp:45
const int MIN_HASH_BASE
Definition hashing.hpp:12
constexpr array< mint, num_bases > gen_bases()
Definition hashing.hpp:16
constexpr array< array< mint, CACHE >, num_bases > init_power(const array< mint, num_bases > &bases)
Definition hashing.hpp:34
Definition hashing.hpp:73
constexpr size_t operator()(const T &o) const
Definition hashing.hpp:74