pipecircuit 0.0.20

Correct. Robust. Fast. Portable. Pick four.
Documentation
#[inline]
pub(super) fn reduce(word: u64, bucket_count: usize) -> usize {
    let product = u128::from(word).wrapping_mul(bucket_count as u128);
    usize::try_from(product >> 64).unwrap_or_default()
}

#[inline]
pub(super) fn next_bucket(bucket: usize, bucket_count: usize) -> usize {
    if bucket == bucket_count.saturating_sub(1) {
        0
    } else {
        bucket.saturating_add(1)
    }
}

#[inline]
pub(super) fn probe_distance(ideal: usize, bucket: usize, bucket_count: usize) -> usize {
    bucket.wrapping_sub(ideal) & bucket_count.saturating_sub(1)
}