Check that vectors aren't padded

This commit is contained in:
Caleb Zulawski 2023-02-19 15:35:36 -05:00
parent 0fd7c8e138
commit 36829ddca7

View File

@ -174,6 +174,7 @@ where
slice.len() >= LANES, slice.len() >= LANES,
"slice length must be at least the number of lanes" "slice length must be at least the number of lanes"
); );
assert!(core::mem::size_of::<Self>() == LANES * core::mem::size_of::<T>());
// Safety: // Safety:
// - We've checked the length is sufficient. // - We've checked the length is sufficient.
// - `T` and `Simd<T, N>` are Copy types. // - `T` and `Simd<T, N>` are Copy types.
@ -203,6 +204,7 @@ where
slice.len() >= LANES, slice.len() >= LANES,
"slice length must be at least the number of lanes" "slice length must be at least the number of lanes"
); );
assert!(core::mem::size_of::<Self>() == LANES * core::mem::size_of::<T>());
// Safety: // Safety:
// - We've checked the length is sufficient // - We've checked the length is sufficient
// - `T` and `Simd<T, N>` are Copy types. // - `T` and `Simd<T, N>` are Copy types.