Trait simba::simd::SimdValue [−][src]
pub trait SimdValue: Sized { type Element: SimdValue<Element = Self::Element, SimdBool = bool>; type SimdBool: SimdBool; 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; 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, { ... } }
Base trait for every SIMD types.
Associated Types
type Element: SimdValue<Element = Self::Element, SimdBool = bool>[src]
The type of the elements of each lane of this SIMD value.
type SimdBool: SimdBool[src]
Type of the result of comparing two SIMD values like self.
Required methods
fn lanes() -> usize[src]
The number of lanes of this SIMD value.
fn splat(val: Self::Element) -> Self[src]
Initializes an SIMD value with each lanes set to val.
fn extract(&self, i: usize) -> Self::Element[src]
Extracts the i-th lane of self.
Panics if i >= Self::lanes().
unsafe fn extract_unchecked(&self, i: usize) -> Self::Element[src]
Extracts the i-th lane of self without bound-checking.
fn replace(&mut self, i: usize, val: Self::Element)[src]
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)[src]
Replaces the i-th lane of self by val without bound-checking.
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
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) -> Self where
Self: Clone, [src]
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
) -> Self where
Self: Clone, [src]
self,
b: Self,
f: impl Fn(Self::Element, Self::Element) -> Self::Element
) -> Self where
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<N: SimdValue> SimdValue for Complex<N>[src]
impl<N: SimdValue> SimdValue for Complex<N>[src]type Element = Complex<N::Element>
type SimdBool = N::SimdBool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, i: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, i: usize) -> Self::Element[src]
fn replace(&mut self, i: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, i: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for bool[src]
impl SimdValue for bool[src]type Element = bool
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for u8[src]
impl SimdValue for u8[src]type Element = u8
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for u16[src]
impl SimdValue for u16[src]type Element = u16
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for u32[src]
impl SimdValue for u32[src]type Element = u32
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for u64[src]
impl SimdValue for u64[src]type Element = u64
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for u128[src]
impl SimdValue for u128[src]type Element = u128
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for usize[src]
impl SimdValue for usize[src]type Element = usize
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for i8[src]
impl SimdValue for i8[src]type Element = i8
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for i16[src]
impl SimdValue for i16[src]type Element = i16
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for i32[src]
impl SimdValue for i32[src]type Element = i32
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for i64[src]
impl SimdValue for i64[src]type Element = i64
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for i128[src]
impl SimdValue for i128[src]type Element = i128
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for isize[src]
impl SimdValue for isize[src]type Element = isize
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for f32[src]
impl SimdValue for f32[src]type Element = f32
type SimdBool = bool
fn lanes() -> usize[src]
fn splat(val: Self::Element) -> Self[src]
fn extract(&self, _: usize) -> Self::Element[src]
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element[src]
fn replace(&mut self, _: usize, val: Self::Element)[src]
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element)[src]
fn select(self, cond: Self::SimdBool, other: Self) -> Self[src]
impl SimdValue for f64[src]
impl SimdValue for f64[src]