use std::collections::{HashMap, HashSet};
use std::hash::{BuildHasherDefault, Hasher};
#[derive(Default)]
pub struct FxHasher {
hash: u64,
}
impl Hasher for FxHasher {
#[inline]
fn write(&mut self, bytes: &[u8]) {
const K: u64 = 0x517c_c1b7_2722_0a95;
for &byte in bytes {
self.hash = (self.hash.rotate_left(5) ^ u64::from(byte)).wrapping_mul(K);
}
}
#[inline]
fn finish(&self) -> u64 {
self.hash
}
}
pub type FxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;
pub type FxHashSet<K> = HashSet<K, BuildHasherDefault<FxHasher>>;