1 //! Private implementation details of public gather/scatter APIs.
2 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 {
25 let x: Simd<usize, LANES> = mem::transmute_copy(&self);
26 mem::transmute_copy(&{ x + (addend * mem::size_of::<T>()) })
31 /// A vector of *mut T. Be very careful around potential aliasing.
32 #[derive(Debug, Copy, Clone)]
34 pub(crate) struct SimdMutPtr<T, const LANES: usize>([*mut T; LANES]);
36 impl<T, const LANES: usize> SimdMutPtr<T, LANES>
38 LaneCount<LANES>: SupportedLaneCount,
43 pub fn splat(ptr: *mut T) -> Self {
49 pub fn wrapping_add(self, addend: Simd<usize, LANES>) -> Self {
51 let x: Simd<usize, LANES> = mem::transmute_copy(&self);
52 mem::transmute_copy(&{ x + (addend * mem::size_of::<T>()) })