diff options
Diffstat (limited to '')
-rw-r--r-- | vendor/packed_simd_2/src/api/ptr/gather_scatter.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/vendor/packed_simd_2/src/api/ptr/gather_scatter.rs b/vendor/packed_simd_2/src/api/ptr/gather_scatter.rs index 430435620..374482ac3 100644 --- a/vendor/packed_simd_2/src/api/ptr/gather_scatter.rs +++ b/vendor/packed_simd_2/src/api/ptr/gather_scatter.rs @@ -22,7 +22,8 @@ macro_rules! impl_ptr_read { /// pointers must be aligned to `mem::align_of::<T>()`. #[inline] pub unsafe fn read<M>( - self, mask: Simd<[M; $elem_count]>, + self, + mask: Simd<[M; $elem_count]>, value: Simd<[T; $elem_count]>, ) -> Simd<[T; $elem_count]> where @@ -128,10 +129,8 @@ macro_rules! impl_ptr_write { /// This method is unsafe because it dereferences raw pointers. The /// pointers must be aligned to `mem::align_of::<T>()`. #[inline] - pub unsafe fn write<M>( - self, mask: Simd<[M; $elem_count]>, - value: Simd<[T; $elem_count]>, - ) where + pub unsafe fn write<M>(self, mask: Simd<[M; $elem_count]>, value: Simd<[T; $elem_count]>) + where M: sealed::Mask, [M; $elem_count]: sealed::SimdArray, { @@ -147,8 +146,8 @@ macro_rules! impl_ptr_write { use super::*; #[test] fn write() { - // fourty_two = [42, 42, 42, ...] - let fourty_two + // forty_two = [42, 42, 42, ...] + let forty_two = Simd::<[i32; $elem_count]>::splat(42_i32); // This test will write to this array @@ -166,11 +165,11 @@ macro_rules! impl_ptr_write { } // ptr = [&arr[0], &arr[1], ...] - // write `fourty_two` to all elements of `v` + // write `forty_two` to all elements of `v` { let backup = arr; unsafe { - ptr.write($mask_ty::splat(true), fourty_two) + ptr.write($mask_ty::splat(true), forty_two) }; assert_eq!(arr, [42_i32; $elem_count]); arr = backup; // arr = [0, 1, 2, ...] @@ -196,7 +195,7 @@ macro_rules! impl_ptr_write { } let backup = arr; - unsafe { ptr.write(mask, fourty_two) }; + unsafe { ptr.write(mask, forty_two) }; assert_eq!(arr, r); arr = backup; // arr = [0, 1, 2, 3, ...] } @@ -205,7 +204,7 @@ macro_rules! impl_ptr_write { { let backup = arr; unsafe { - ptr.write($mask_ty::splat(false), fourty_two) + ptr.write($mask_ty::splat(false), forty_two) }; assert_eq!(arr, backup); } |