diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /vendor/packed_simd_2/src/api/ptr/gather_scatter.rs | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/packed_simd_2/src/api/ptr/gather_scatter.rs')
-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); } |