//! Private implementation details of public gather/scatter APIs. use crate::simd::intrinsics; use crate::simd::{LaneCount, Simd, SupportedLaneCount}; /// A vector of *const T. #[derive(Debug, Copy, Clone)] #[repr(simd)] pub(crate) struct SimdConstPtr([*const T; LANES]); impl SimdConstPtr where LaneCount: SupportedLaneCount, T: Sized, { #[inline] #[must_use] pub fn splat(ptr: *const T) -> Self { Self([ptr; LANES]) } #[inline] #[must_use] pub fn wrapping_add(self, addend: Simd) -> Self { // Safety: this intrinsic doesn't have a precondition unsafe { intrinsics::simd_arith_offset(self, addend) } } } /// A vector of *mut T. Be very careful around potential aliasing. #[derive(Debug, Copy, Clone)] #[repr(simd)] pub(crate) struct SimdMutPtr([*mut T; LANES]); impl SimdMutPtr where LaneCount: SupportedLaneCount, T: Sized, { #[inline] #[must_use] pub fn splat(ptr: *mut T) -> Self { Self([ptr; LANES]) } #[inline] #[must_use] pub fn wrapping_add(self, addend: Simd) -> Self { // Safety: this intrinsic doesn't have a precondition unsafe { intrinsics::simd_arith_offset(self, addend) } } }