55[[nodiscard]]
static inline uint64_t
random_64();
84[[nodiscard]]
static inline uint64_t
hash_uint64(uint64_t value);
94[[nodiscard]]
static inline uint64_t
hash_uint64_pair(uint64_t n1, uint64_t n2);
102 const byte *
buf,
size_t len, uint64_t seed = 0xacb1f3526e25dd39);
121 constexpr uint32_t HASH_RANDOM_MASK = 1463735687;
122 constexpr uint32_t HASH_RANDOM_MASK2 = 1653893711;
124 return ((((n1 ^ n2 ^ HASH_RANDOM_MASK2) << 8) + n1) ^ HASH_RANDOM_MASK) + n2;
140static inline int64_t
read_from_1(
const byte *addr) {
return *addr; }
172 return res != 0 ? res >> 5 :
random_64();
175template <u
int64_t random_64_func()>
178 return low + (random_64_func() % (high - low + 1));
182 return random_from_interval_gen<random_64>(low, high);
186 return random_from_interval_gen<random_64_fast>(low, high);
192 return crc32_hash_uint64(value);
202 for (
size_t i = 0; i <
sizeof(uint64_t); ++i) {
238 uint64_t last_part = 0;
239 if ((len & 7) == 0) {
259 uint32_t hash_value = 0;
260 const byte *str_end =
str + (len & 0xFFFFFFF8);
264 while (
str < str_end) {
ulonglong my_timer_cycles(void)
A cycle timer.
Definition: my_rdtsc.cc:98
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105
Definition: buf0block_hint.cc:30
Definition: ut0tuple.h:57
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:120
static int64_t read_from_4(const byte *addr)
Definition: ut0rnd.h:144
static int64_t read_from_8(const byte *addr)
Definition: ut0rnd.h:147
thread_local uint64_t random_seed
Seed value of ut::random_64()
Definition: ut0rnd.cc:40
static int64_t read_from_1(const byte *addr)
Definition: ut0rnd.h:140
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:44
static int64_t read_from_2(const byte *addr)
Definition: ut0rnd.h:141
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:48
static uint64_t random_from_interval(uint64_t low, uint64_t high)
Generates a pseudo-random integer from a given interval.
Definition: ut0rnd.h:181
static uint64_t hash_string(const char *str)
Hashes a character string ending in the null character.
Definition: ut0rnd.h:212
static uint64_t hash_uint64(uint64_t value)
Hashes a 64-bit integer.
Definition: ut0rnd.h:189
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:258
static uint64_t hash_binary(const byte *buf, size_t len, uint64_t seed=0xacb1f3526e25dd39)
Hashes a binary buffer of given length.
Definition: ut0rnd.h:216
static uint64_t random_64_fast()
The following function returns fine clock count as random value.
Definition: ut0rnd.h:168
static uint64_t random_64()
The following function generates pseudo-random 64bit integers which enumerate the value space generat...
Definition: ut0rnd.h:163
static uint64_t hash_uint64_pair(uint64_t n1, uint64_t n2)
Hashes a pair of 64bit integers.
Definition: ut0rnd.h:208
static uint64_t random_from_interval_fast(uint64_t low, uint64_t high)
Generates a light-weight pseudo-random integer from a given interval.
Definition: ut0rnd.h:185
static uint64_t random_from_interval_gen(uint64_t low, uint64_t high)
Definition: ut0rnd.h:176
Version control for database, common definitions, and include files.
Utilities for byte operations.
Utilities related to class lifecycle.
bool ut_crc32_cpu_enabled
Flag that tells whether the CPU supports CRC32 or not.
Definition: crc32.cc:103
ut_crc32_func_t ut_crc32
Pointer to standard-compliant CRC32-C (using the GF(2) primitive polynomial 0x11EDC6F41) calculation ...
Definition: crc32.cc:101
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105
Implements a sequential lock structure for non-locking atomic read/write operations on a complex stru...