Skip to content

Commit

Permalink
Add comment for test_simd_padding, mention #92
Browse files Browse the repository at this point in the history
  • Loading branch information
yoanlcq committed Jul 16, 2023
1 parent b5030c6 commit 6e9dd5d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3808,6 +3808,8 @@ mod tests {
}
};
(repr_simd_padding $Vec:ident<$T:ident>) => {
// This test aims to prove that types in the `repr_simd` modules have no padding/uninit bytes, which is a requirement for implementing bytemuck's Pod trait.
// In the past, `#[repr(simd)] Vec3<T>` had that issue as the compiler treated it as an aligned Vec4 in memory, but since some time, the compiler stopped supporting non-power-of-two SIMD types, so we were forced to write them as `#[repr(C)]`, which means that now they don't have any padding, but they're also not true SIMD types, which is fine : users should use Vec4 instead if they want SIMD.
#[test]
fn test_simd_padding() {
let count = $Vec::<$T>::ELEM_COUNT;
Expand Down

0 comments on commit 6e9dd5d

Please sign in to comment.