pub trait SimdValue: Sized {
    type Element: SimdValue<Element = Self::Element, SimdBool = bool>;
    type SimdBool: SimdBool;

    // Required methods
    fn lanes() -> usize;
    fn splat(val: Self::Element) -> Self;
    fn extract(&self, i: usize) -> Self::Element;
    unsafe fn extract_unchecked(&self, i: usize) -> Self::Element;
    fn replace(&mut self, i: usize, val: Self::Element);
    unsafe fn replace_unchecked(&mut self, i: usize, val: Self::Element);
    fn select(self, cond: Self::SimdBool, other: Self) -> Self;

    // Provided methods
    fn map_lanes(self, f: impl Fn(Self::Element) -> Self::Element) -> Self
       where Self: Clone { ... }
    fn zip_map_lanes(
        self,
        b: Self,
        f: impl Fn(Self::Element, Self::Element) -> Self::Element
    ) -> Self
       where Self: Clone { ... }
}
Expand description

Base trait for every SIMD types.

Required Associated Types§

type Element: SimdValue<Element = Self::Element, SimdBool = bool>

The type of the elements of each lane of this SIMD value.

type SimdBool: SimdBool

Type of the result of comparing two SIMD values like self.

Required Methods§

fn lanes() -> usize

The number of lanes of this SIMD value.

fn splat(val: Self::Element) -> Self

Initializes an SIMD value with each lanes set to val.

fn extract(&self, i: usize) -> Self::Element

Extracts the i-th lane of self.

Panics if i >= Self::lanes().

unsafe fn extract_unchecked(&self, i: usize) -> Self::Element

Extracts the i-th lane of self without bound-checking.

fn replace(&mut self, i: usize, val: Self::Element)

Replaces the i-th lane of self by val.

Panics if i >= Self::lanes().

unsafe fn replace_unchecked(&mut self, i: usize, val: Self::Element)

Replaces the i-th lane of self by val without bound-checking.

fn select(self, cond: Self::SimdBool, other: Self) -> Self

Merges self and other depending on the lanes of cond.

For each lane of cond with bits set to 1, the result’s will contain the value of the lane of self. For each lane of cond with bits set to 0, the result’s will contain the value of the lane of other.

Provided Methods§

fn map_lanes(self, f: impl Fn(Self::Element) -> Self::Element) -> Selfwhere Self: Clone,

Applies a function to each lane of self.

Note that, while convenient, this method can be extremely slow as this requires to extract each lane of self and then combine them again into a new SIMD value.

fn zip_map_lanes( self, b: Self, f: impl Fn(Self::Element, Self::Element) -> Self::Element ) -> Selfwhere Self: Clone,

Applies a function to each lane of self paired with the corresponding lane of b.

Note that, while convenient, this method can be extremely slow as this requires to extract each lane of self and then combine them again into a new SIMD value.

Implementations on Foreign Types§

§

impl SimdValue for i64

§

type Element = i64

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <i64 as SimdValue>::Element) -> i64

§

fn extract(&self, _: usize) -> <i64 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <i64 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <i64 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <i64 as SimdValue>::Element )

§

fn select(self, cond: <i64 as SimdValue>::SimdBool, other: i64) -> i64

§

impl SimdValue for u128

§

type Element = u128

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <u128 as SimdValue>::Element) -> u128

§

fn extract(&self, _: usize) -> <u128 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <u128 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <u128 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <u128 as SimdValue>::Element )

§

fn select(self, cond: <u128 as SimdValue>::SimdBool, other: u128) -> u128

§

impl SimdValue for u16

§

type Element = u16

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <u16 as SimdValue>::Element) -> u16

§

fn extract(&self, _: usize) -> <u16 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <u16 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <u16 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <u16 as SimdValue>::Element )

§

fn select(self, cond: <u16 as SimdValue>::SimdBool, other: u16) -> u16

§

impl SimdValue for f64

§

type Element = f64

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <f64 as SimdValue>::Element) -> f64

§

fn extract(&self, _: usize) -> <f64 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <f64 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <f64 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <f64 as SimdValue>::Element )

§

fn select(self, cond: <f64 as SimdValue>::SimdBool, other: f64) -> f64

§

impl SimdValue for i128

§

type Element = i128

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <i128 as SimdValue>::Element) -> i128

§

fn extract(&self, _: usize) -> <i128 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <i128 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <i128 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <i128 as SimdValue>::Element )

§

fn select(self, cond: <i128 as SimdValue>::SimdBool, other: i128) -> i128

§

impl SimdValue for u64

§

type Element = u64

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <u64 as SimdValue>::Element) -> u64

§

fn extract(&self, _: usize) -> <u64 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <u64 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <u64 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <u64 as SimdValue>::Element )

§

fn select(self, cond: <u64 as SimdValue>::SimdBool, other: u64) -> u64

§

impl SimdValue for i8

§

type Element = i8

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <i8 as SimdValue>::Element) -> i8

§

fn extract(&self, _: usize) -> <i8 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <i8 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <i8 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <i8 as SimdValue>::Element )

§

fn select(self, cond: <i8 as SimdValue>::SimdBool, other: i8) -> i8

§

impl SimdValue for i32

§

type Element = i32

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <i32 as SimdValue>::Element) -> i32

§

fn extract(&self, _: usize) -> <i32 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <i32 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <i32 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <i32 as SimdValue>::Element )

§

fn select(self, cond: <i32 as SimdValue>::SimdBool, other: i32) -> i32

§

impl SimdValue for f32

§

type Element = f32

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <f32 as SimdValue>::Element) -> f32

§

fn extract(&self, _: usize) -> <f32 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <f32 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <f32 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <f32 as SimdValue>::Element )

§

fn select(self, cond: <f32 as SimdValue>::SimdBool, other: f32) -> f32

§

impl SimdValue for u8

§

type Element = u8

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <u8 as SimdValue>::Element) -> u8

§

fn extract(&self, _: usize) -> <u8 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <u8 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <u8 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <u8 as SimdValue>::Element )

§

fn select(self, cond: <u8 as SimdValue>::SimdBool, other: u8) -> u8

§

impl SimdValue for isize

§

type Element = isize

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <isize as SimdValue>::Element) -> isize

§

fn extract(&self, _: usize) -> <isize as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <isize as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <isize as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <isize as SimdValue>::Element )

§

fn select(self, cond: <isize as SimdValue>::SimdBool, other: isize) -> isize

§

impl SimdValue for i16

§

type Element = i16

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <i16 as SimdValue>::Element) -> i16

§

fn extract(&self, _: usize) -> <i16 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <i16 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <i16 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <i16 as SimdValue>::Element )

§

fn select(self, cond: <i16 as SimdValue>::SimdBool, other: i16) -> i16

§

impl SimdValue for u32

§

type Element = u32

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <u32 as SimdValue>::Element) -> u32

§

fn extract(&self, _: usize) -> <u32 as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <u32 as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <u32 as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <u32 as SimdValue>::Element )

§

fn select(self, cond: <u32 as SimdValue>::SimdBool, other: u32) -> u32

§

impl SimdValue for usize

§

type Element = usize

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <usize as SimdValue>::Element) -> usize

§

fn extract(&self, _: usize) -> <usize as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <usize as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <usize as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <usize as SimdValue>::Element )

§

fn select(self, cond: <usize as SimdValue>::SimdBool, other: usize) -> usize

§

impl SimdValue for bool

§

type Element = bool

§

type SimdBool = bool

§

fn lanes() -> usize

§

fn splat(val: <bool as SimdValue>::Element) -> bool

§

fn extract(&self, _: usize) -> <bool as SimdValue>::Element

§

unsafe fn extract_unchecked(&self, _: usize) -> <bool as SimdValue>::Element

§

fn replace(&mut self, _: usize, val: <bool as SimdValue>::Element)

§

unsafe fn replace_unchecked( &mut self, _: usize, val: <bool as SimdValue>::Element )

§

fn select(self, cond: <bool as SimdValue>::SimdBool, other: bool) -> bool

Implementors§

§

impl SimdValue for AutoSimd<[bool; 1]>

§

impl SimdValue for AutoSimd<[bool; 2]>

§

impl SimdValue for AutoSimd<[bool; 4]>

§

impl SimdValue for AutoSimd<[bool; 8]>

§

impl SimdValue for AutoSimd<[bool; 16]>

§

impl SimdValue for AutoSimd<[bool; 32]>

§

impl SimdValue for AutoSimd<[f32; 2]>

§

impl SimdValue for AutoSimd<[f32; 4]>

§

impl SimdValue for AutoSimd<[f32; 8]>

§

impl SimdValue for AutoSimd<[f32; 16]>

§

impl SimdValue for AutoSimd<[f64; 2]>

§

impl SimdValue for AutoSimd<[f64; 4]>

§

impl SimdValue for AutoSimd<[f64; 8]>

§

impl SimdValue for AutoSimd<[i8; 2]>

§

impl SimdValue for AutoSimd<[i8; 4]>

§

impl SimdValue for AutoSimd<[i8; 8]>

§

impl SimdValue for AutoSimd<[i8; 16]>

§

impl SimdValue for AutoSimd<[i8; 32]>

§

impl SimdValue for AutoSimd<[i16; 2]>

§

impl SimdValue for AutoSimd<[i16; 4]>

§

impl SimdValue for AutoSimd<[i16; 8]>

§

impl SimdValue for AutoSimd<[i16; 16]>

§

impl SimdValue for AutoSimd<[i16; 32]>

§

impl SimdValue for AutoSimd<[i32; 2]>

§

impl SimdValue for AutoSimd<[i32; 4]>

§

impl SimdValue for AutoSimd<[i32; 8]>

§

impl SimdValue for AutoSimd<[i32; 16]>

§

impl SimdValue for AutoSimd<[i64; 2]>

§

impl SimdValue for AutoSimd<[i64; 4]>

§

impl SimdValue for AutoSimd<[i64; 8]>

§

impl SimdValue for AutoSimd<[i128; 1]>

§

impl SimdValue for AutoSimd<[i128; 2]>

§

impl SimdValue for AutoSimd<[i128; 4]>

§

impl SimdValue for AutoSimd<[isize; 2]>

§

impl SimdValue for AutoSimd<[isize; 4]>

§

impl SimdValue for AutoSimd<[isize; 8]>

§

impl SimdValue for AutoSimd<[u8; 2]>

§

impl SimdValue for AutoSimd<[u8; 4]>

§

impl SimdValue for AutoSimd<[u8; 8]>

§

impl SimdValue for AutoSimd<[u8; 16]>

§

impl SimdValue for AutoSimd<[u8; 32]>

§

impl SimdValue for AutoSimd<[u16; 2]>

§

impl SimdValue for AutoSimd<[u16; 4]>

§

impl SimdValue for AutoSimd<[u16; 8]>

§

impl SimdValue for AutoSimd<[u16; 16]>

§

impl SimdValue for AutoSimd<[u16; 32]>

§

impl SimdValue for AutoSimd<[u32; 2]>

§

impl SimdValue for AutoSimd<[u32; 4]>

§

impl SimdValue for AutoSimd<[u32; 8]>

§

impl SimdValue for AutoSimd<[u32; 16]>

§

impl SimdValue for AutoSimd<[u64; 2]>

§

impl SimdValue for AutoSimd<[u64; 4]>

§

impl SimdValue for AutoSimd<[u64; 8]>

§

impl SimdValue for AutoSimd<[u128; 1]>

§

impl SimdValue for AutoSimd<[u128; 2]>

§

impl SimdValue for AutoSimd<[u128; 4]>

§

impl SimdValue for AutoSimd<[usize; 2]>

§

impl SimdValue for AutoSimd<[usize; 4]>

§

impl SimdValue for AutoSimd<[usize; 8]>

§

impl SimdValue for WideBoolF32x4

§

impl SimdValue for WideF32x4

§

impl<N> SimdValue for Complex<N>where N: SimdValue,

source§

impl<T> SimdValue for Quaternion<T>where T: Scalar + SimdValue, <T as SimdValue>::Element: Scalar,

source§

impl<T> SimdValue for Unit<Complex<T>>where T: SimdRealField, <T as SimdValue>::Element: SimdRealField,

source§

impl<T> SimdValue for Unit<Quaternion<T>>where T: Scalar + SimdValue, <T as SimdValue>::Element: Scalar,

source§

impl<T, C, const D: usize> SimdValue for Transform<T, C, D>where T: RealField, <T as SimdValue>::Element: Scalar, C: TCategory, Const<D>: DimNameAdd<Const<1>>, DefaultAllocator: Allocator<T, <Const<D> as DimNameAdd<Const<1>>>::Output, <Const<D> as DimNameAdd<Const<1>>>::Output> + Allocator<<T as SimdValue>::Element, <Const<D> as DimNameAdd<Const<1>>>::Output, <Const<D> as DimNameAdd<Const<1>>>::Output>,

§

type Element = Transform<<T as SimdValue>::Element, C, D>

§

type SimdBool = <T as SimdValue>::SimdBool

source§

impl<T, R, C> SimdValue for Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>where T: Scalar + SimdValue, R: Dim, C: Dim, <T as SimdValue>::Element: Scalar, DefaultAllocator: Allocator<T, R, C> + Allocator<<T as SimdValue>::Element, R, C>,

source§

impl<T, R, const D: usize> SimdValue for Isometry<T, R, D>where T: SimdRealField, <T as SimdValue>::Element: SimdRealField, R: SimdValue<SimdBool = <T as SimdValue>::SimdBool> + AbstractRotation<T, D>, <R as SimdValue>::Element: AbstractRotation<<T as SimdValue>::Element, D>,

source§

impl<T, R, const D: usize> SimdValue for Similarity<T, R, D>where T: SimdRealField, <T as SimdValue>::Element: SimdRealField, R: SimdValue<SimdBool = <T as SimdValue>::SimdBool> + AbstractRotation<T, D>, <R as SimdValue>::Element: AbstractRotation<<T as SimdValue>::Element, D>,

source§

impl<T, const D: usize> SimdValue for OPoint<T, Const<D>>where T: Scalar + SimdValue, <T as SimdValue>::Element: Scalar,

source§

impl<T, const D: usize> SimdValue for Rotation<T, D>where T: Scalar + SimdValue, <T as SimdValue>::Element: Scalar,

source§

impl<T, const D: usize> SimdValue for Translation<T, D>where T: Scalar + SimdValue, <T as SimdValue>::Element: Scalar,