1
Fork 0

Use modular arithmetic

This commit is contained in:
Jakub Beránek 2021-12-12 22:54:09 +01:00
parent a5f5f6b689
commit 6e33d3ecc2
No known key found for this signature in database
GPG key ID: DBC553E540C2F619

View file

@ -503,7 +503,7 @@ impl_stable_hash_via_hash!(::std::path::PathBuf);
impl<K, V, R, HCX> HashStable<HCX> for ::std::collections::HashMap<K, V, R>
where
K: ToStableHashKey<HCX> + Eq,
K: HashStable<HCX> + ToStableHashKey<HCX> + Eq,
V: HashStable<HCX>,
R: BuildHasher,
{
@ -555,7 +555,7 @@ pub fn hash_stable_hashmap<HCX, K, V, R, SK, F>(
map: &::std::collections::HashMap<K, V, R>,
to_stable_hash_key: F,
) where
K: Eq,
K: Eq + HashStable<HCX>,
V: HashStable<HCX>,
R: BuildHasher,
SK: HashStable<HCX> + Ord,
@ -570,7 +570,7 @@ pub fn hash_stable_hashmap<HCX, K, V, R, SK, F>(
value.hash_stable(hcx, &mut hasher);
hasher.finish::<u128>()
})
.reduce(|accum, value| accum.wrapping_mul(value));
.reduce(|accum, value| accum.wrapping_add(value));
map.len().hash_stable(hcx, hasher);
hash.hash_stable(hcx, hasher);
}