#[inline(always)]
pub(crate) const fn wymix(first: u64, second: u64) -> u64 {
let (lo, hi) = wymul(first, second);
lo ^ hi
}
#[inline(always)]
pub(crate) const fn wymul(first: u64, second: u64) -> (u64, u64) {
let total = (first as u128).wrapping_mul(second as u128);
(total as u64, total.wrapping_shr(64) as u64)
}
#[cfg(feature = "wyhash")]
#[inline(always)]
pub(crate) const fn check_for_valid_secret_value(current_value: usize, secret: &[u64; 4]) -> bool {
if secret[current_value] % 2 == 0 {
return false;
}
let mut prev_value: usize = 0;
while prev_value < current_value {
if (secret[prev_value] ^ secret[current_value]).count_ones() != 32 {
return false;
}
prev_value += 1;
}
true
}
#[cfg(feature = "randomised_wyhash")]
#[inline]
pub(crate) fn get_random_u64() -> u64 {
#[cfg(not(feature = "threadrng_wyhash"))]
{
getrandom::u64().expect("Failed to source entropy for WyHash randomised state")
}
#[cfg(feature = "threadrng_wyhash")]
{
use rand_core::Rng;
rand::rng().next_u64()
}
}