54[[nodiscard]]
static inline uint64_t
random_64();
83[[nodiscard]]
static inline uint64_t
hash_uint64(uint64_t value);
93[[nodiscard]]
static inline uint64_t
hash_uint64_pair(uint64_t n1, uint64_t n2);
101 const byte *
buf,
size_t len, uint64_t seed = 0xacb1f3526e25dd39);
120 constexpr uint32_t HASH_RANDOM_MASK = 1463735687;
121 constexpr uint32_t HASH_RANDOM_MASK2 = 1653893711;
123 return ((((n1 ^ n2 ^ HASH_RANDOM_MASK2) << 8) + n1) ^ HASH_RANDOM_MASK) + n2;
139static inline int64_t
read_from_1(
const byte *addr) {
return *addr; }
171 return res != 0 ? res >> 5 :
random_64();
174template <u
int64_t random_64_func()>
177 return low + (random_64_func() % (high - low + 1));
181 return random_from_interval_gen<random_64>(low, high);
185 return random_from_interval_gen<random_64_fast>(low, high);
191 return crc32_hash_uint64(value);
201 for (
size_t i = 0; i <
sizeof(uint64_t); ++i) {
237 uint64_t last_part = 0;
238 if ((len & 7) == 0) {
258 uint32_t hash_value = 0;
259 const byte *str_end =
str + (len & 0xFFFFFFF8);
263 while (
str < str_end) {
ulonglong my_timer_cycles(void)
A cycle timer.
Definition: my_rdtsc.cc:97
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1065
Definition: buf0block_hint.cc:29
Definition: ut0tuple.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:119
static int64_t read_from_4(const byte *addr)
Definition: ut0rnd.h:143
static int64_t read_from_8(const byte *addr)
Definition: ut0rnd.h:146
thread_local uint64_t random_seed
Seed value of ut::random_64()
Definition: ut0rnd.cc:39
static int64_t read_from_1(const byte *addr)
Definition: ut0rnd.h:139
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:43
static int64_t read_from_2(const byte *addr)
Definition: ut0rnd.h:140
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:180
static uint64_t hash_string(const char *str)
Hashes a character string ending in the null character.
Definition: ut0rnd.h:211
static uint64_t hash_uint64(uint64_t value)
Hashes a 64-bit integer.
Definition: ut0rnd.h:188
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:257
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:215
static uint64_t random_64_fast()
The following function returns fine clock count as random value.
Definition: ut0rnd.h:167
static uint64_t random_64()
The following function generates pseudo-random 64bit integers which enumerate the value space generat...
Definition: ut0rnd.h:162
static uint64_t hash_uint64_pair(uint64_t n1, uint64_t n2)
Hashes a pair of 64bit integers.
Definition: ut0rnd.h:207
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:184
static uint64_t random_from_interval_gen(uint64_t low, uint64_t high)
Definition: ut0rnd.h:175
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:102
ut_crc32_func_t ut_crc32
Pointer to standard-compliant CRC32-C (using the GF(2) primitive polynomial 0x11EDC6F41) calculation ...
Definition: crc32.cc:100
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:104
Implements a sequential lock structure for non-locking atomic read/write operations on a complex stru...