Simplify hash code (#414)

This commit is contained in:
Denis Isidoro 2020-09-16 09:08:52 -03:00 committed by GitHub
parent a63a11c099
commit 5a758f00e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,13 +22,9 @@ impl Hasher for FnvHasher {
}
fn write(&mut self, bytes: &[u8]) {
let FnvHasher(mut hash) = *self;
for byte in bytes.iter() {
hash ^= u64::from(*byte);
hash = hash.wrapping_mul(0x0100_0000_01b3);
self.0 ^= u64::from(*byte);
self.0 = self.0.wrapping_mul(0x0100_0000_01b3);
}
*self = FnvHasher(hash);
}
}