Added a StableHasherResult
impl for u128
.
This commit is contained in:
parent
60ac9f467c
commit
70fa1fbea7
@ -78,6 +78,17 @@ impl StableHasherResult for [u8; 20] {
|
||||
}
|
||||
}
|
||||
|
||||
impl StableHasherResult for u128 {
|
||||
fn finish(mut hasher: StableHasher<Self>) -> Self {
|
||||
let hash_bytes: &[u8] = hasher.finalize();
|
||||
assert!(hash_bytes.len() >= mem::size_of::<u64>() * 2);
|
||||
|
||||
unsafe {
|
||||
::std::ptr::read_unaligned(hash_bytes.as_ptr() as *const u128)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl StableHasherResult for u64 {
|
||||
fn finish(mut hasher: StableHasher<Self>) -> Self {
|
||||
hasher.state.finalize();
|
||||
|
Loading…
x
Reference in New Issue
Block a user