0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-26 00:59:28 -05:00

chore: support 128-bit TypeId (#1249)

This commit is contained in:
Matt Mastracci 2023-06-15 19:00:42 +02:00 committed by GitHub
parent 5a15d85f2f
commit 270f46aa5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1686,6 +1686,8 @@ impl Hasher for TypeIdHasher {
#[inline]
fn write_u64(&mut self, value: u64) {
// The internal hash function of TypeId only takes the bottom 64-bits, even on versions
// of Rust that use a 128-bit TypeId.
let prev_state = self.state.replace(value);
debug_assert_eq!(prev_state, None);
}
@ -1712,8 +1714,14 @@ impl BuildHasher for BuildTypeIdHasher {
}
const _: () = {
assert!(size_of::<TypeId>() == size_of::<u64>());
assert!(align_of::<TypeId>() == align_of::<u64>());
assert!(
size_of::<TypeId>() == size_of::<u64>()
|| size_of::<TypeId>() == size_of::<u128>()
);
assert!(
align_of::<TypeId>() == align_of::<u64>()
|| align_of::<TypeId>() == align_of::<u128>()
);
};
pub(crate) struct RawSlot {