Skip to content

Commit 36829dd

Browse files
committed
Check that vectors aren't padded
1 parent 0fd7c8e commit 36829dd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/core_simd/src/vector.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ where
174174
slice.len() >= LANES,
175175
"slice length must be at least the number of lanes"
176176
);
177+
assert!(core::mem::size_of::<Self>() == LANES * core::mem::size_of::<T>());
177178
// Safety:
178179
// - We've checked the length is sufficient.
179180
// - `T` and `Simd<T, N>` are Copy types.
@@ -203,6 +204,7 @@ where
203204
slice.len() >= LANES,
204205
"slice length must be at least the number of lanes"
205206
);
207+
assert!(core::mem::size_of::<Self>() == LANES * core::mem::size_of::<T>());
206208
// Safety:
207209
// - We've checked the length is sufficient
208210
// - `T` and `Simd<T, N>` are Copy types.

0 commit comments

Comments
 (0)