Use UnhashMap for a few more maps
This avoids hashing data that's already hashed.
This commit is contained in:
@@ -75,11 +75,21 @@ impl fmt::LowerHex for Hash64 {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default)]
|
||||
pub struct Hash128 {
|
||||
inner: u128,
|
||||
}
|
||||
|
||||
// We expect Hash128 to be well mixed. So there's no point in hashing both parts.
|
||||
//
|
||||
// This also allows using Hash128-containing types in UnHash-based hashmaps, which would otherwise
|
||||
// debug_assert! that we're hashing more than a single u64.
|
||||
impl std::hash::Hash for Hash128 {
|
||||
fn hash<H: std::hash::Hasher>(&self, h: &mut H) {
|
||||
h.write_u64(self.truncate().as_u64());
|
||||
}
|
||||
}
|
||||
|
||||
impl Hash128 {
|
||||
#[inline]
|
||||
pub fn truncate(self) -> Hash64 {
|
||||
|
||||
Reference in New Issue
Block a user