1 //! Private implementation details of public gather/scatter APIs.
2 use crate::simd::intrinsics;
3 use crate::simd::{LaneCount, Simd, SupportedLaneCount};
5 /// A vector of *const T.
6 #[derive(Debug, Copy, Clone)]
8 pub(crate) struct SimdConstPtr<T, const LANES: usize>([*const T; LANES]);
10 impl<T, const LANES: usize> SimdConstPtr<T, LANES>
12 LaneCount<LANES>: SupportedLaneCount,
17 pub fn splat(ptr: *const T) -> Self {
23 pub fn wrapping_add(self, addend: Simd<usize, LANES>) -> Self {
24 // Safety: this intrinsic doesn't have a precondition
25 unsafe { intrinsics::simd_arith_offset(self, addend) }
29 /// A vector of *mut T. Be very careful around potential aliasing.
30 #[derive(Debug, Copy, Clone)]
32 pub(crate) struct SimdMutPtr<T, const LANES: usize>([*mut T; LANES]);
34 impl<T, const LANES: usize> SimdMutPtr<T, LANES>
36 LaneCount<LANES>: SupportedLaneCount,
41 pub fn splat(ptr: *mut T) -> Self {
47 pub fn wrapping_add(self, addend: Simd<usize, LANES>) -> Self {
48 // Safety: this intrinsic doesn't have a precondition
49 unsafe { intrinsics::simd_arith_offset(self, addend) }