sux/func/
mod.rs

1/*
2 * SPDX-FileCopyrightText: 2023 Inria
3 * SPDX-FileCopyrightText: 2023 Sebastiano Vigna
4 *
5 * SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
6 */
7
8//! Static functions.
9//!
10//! Static functions map keys to values, but they do not store the keys:
11//! querying a static function with a key outside of the original set will lead
12//! to an arbitrary result.
13//!
14//! In exchange, static functions make it possible to store the association
15//! between keys and values just in the space required by the values, plus
16//! a small overhead.
17//!
18//! See [`VFunc`] for more details.
19
20mod vfunc;
21pub use vfunc::*;
22
23mod vbuilder;
24pub use vbuilder::*;
25
26pub mod shard_edge;
27
28/// Avalanches bits using the finalization step of Austin Appleby's
29/// [MurmurHash3](http://code.google.com/p/smhasher/).
30#[doc(hidden)]
31pub const fn mix64(mut k: u64) -> u64 {
32    k ^= k >> 33;
33    k = k.overflowing_mul(0xff51_afd7_ed55_8ccd).0;
34    k ^= k >> 33;
35    k = k.overflowing_mul(0xc4ce_b9fe_1a85_ec53).0;
36    k ^= k >> 33;
37    k
38}