66[[nodiscard]]
static inline uint64_t
random_64();
79[[nodiscard]]
static inline uint64_t
hash_uint64(uint64_t value);
89[[nodiscard]]
static inline uint64_t
hash_uint64_pair(uint64_t n1, uint64_t n2);
96 const byte *
buf,
size_t len,
116 constexpr uint32_t HASH_RANDOM_MASK = 1463735687;
117 constexpr uint32_t HASH_RANDOM_MASK2 = 1653893711;
119 return ((((n1 ^ n2 ^ HASH_RANDOM_MASK2) << 8) + n1) ^ HASH_RANDOM_MASK) + n2;
135static inline int64_t
read_from_1(
const byte *addr) {
return *addr; }
182 return low + (
random_64() % (high - low + 1));
192 for (
size_t i = 0; i <
sizeof(uint64_t); ++i) {
228 uint64_t last_part = 0;
229 if ((len & 7) == 0) {
249 uint32_t hash_value = 0;
250 const byte *str_end =
str + (len & 0xFFFFFFF8);
254 while (
str < str_end) {
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1054
Definition: buf0block_hint.cc:29
Definition: ut0tuple.h:56
constexpr uint64_t fast_hash_coeff_b_64bit
Definition: ut0rnd.h:56
constexpr uint32_t hash_uint32_pair_ib(uint32_t n1, uint32_t n2)
A helper method, it is used by hash_binary_ib for backward compatibility.
Definition: ut0rnd.h:115
static int64_t read_from_4(const byte *addr)
Definition: ut0rnd.h:139
static int64_t read_from_8(const byte *addr)
Definition: ut0rnd.h:142
constexpr uint64_t fast_hash_coeff_a1_64bit
Definition: ut0rnd.h:54
thread_local uint64_t random_seed
Seed value of ut::random_64()
Definition: ut0rnd.cc:38
static int64_t read_from_1(const byte *addr)
Definition: ut0rnd.h:135
constexpr uint64_t fast_hash_coeff_a2_64bit
Definition: ut0rnd.h:55
std::array< std::array< uint64_t, 8 >, 256 > tab_hash_lookup_table
Table for Tabulation Hashing, precomputed hash values for all byte values.
Definition: ut0rnd.cc:42
static int64_t read_from_2(const byte *addr)
Definition: ut0rnd.h:136
constexpr uint64_t hash_uint64_pair_fast(uint64_t n1, uint64_t n2)
Calculates 64bit hash from two 64bit inputs.
Definition: ut0rnd.h:149
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:47
static uint64_t random_from_interval(uint64_t low, uint64_t high)
Generates a pseudo-random integer from a given interval.
Definition: ut0rnd.h:179
static uint64_t hash_string(const char *str)
Hashes a character string ending in the null character.
Definition: ut0rnd.h:202
static uint64_t hash_binary(const byte *buf, size_t len, uint64_t seed=detail::fast_hash_coeff_a1_64bit)
Hashes a binary buffer of given length.
Definition: ut0rnd.h:206
static uint64_t hash_uint64(uint64_t value)
Hashes a 64-bit integer.
Definition: ut0rnd.h:185
static uint32_t hash_binary_ib(const byte *str, size_t len)
Hashes a binary buffer of given length in the old innobase way.
Definition: ut0rnd.h:248
static uint64_t random_64()
The following function generates pseudo-random 64bit integers which enumerate the value space generat...
Definition: ut0rnd.h:175
static uint64_t hash_uint64_pair(uint64_t n1, uint64_t n2)
Hashes a pair of 64bit integers.
Definition: ut0rnd.h:198
Version control for database, common definitions, and include files.
Utilities for byte operations.
Utilities related to class lifecycle.
ut_crc32_func_t ut_crc32
Pointer to standard-compliant CRC32-C (using the GF(2) primitive polynomial 0x11EDC6F41) calculation ...
Definition: crc32.cc:128
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:68
Implements a sequential lock structure for non-locking atomic read/write operations on a complex stru...