Skip to main content

SimdWiden

Trait SimdWiden 

Source
pub trait SimdWiden<S: Simd>: SimdBase<S> + Seal {
    type Widened: SimdNarrow<S, Narrowed = Self>;

    // Required method
    fn widen(self) -> (Self::Widened, Self::Widened);
}
Expand description

Widening conversion of a numeric SIMD vector.

Integer lanes are sign-extended or zero-extended according to their type. Finite floating-point lanes are converted losslessly from f32 to f64; infinities and NaNs remain infinities and NaNs. The result is returned as two vectors with the same bit width as the input: the first contains the widened lower lanes and the second contains the widened upper lanes.

use fearless_simd::{f32x4, f64x2, prelude::*, u8x16, u16x8};

fn fixed<S: Simd>(value: u8x16<S>) -> (u16x8<S>, u16x8<S>) {
    value.widen()
}

fn native<S: Simd>(value: S::u8s) -> (S::u16s, S::u16s) {
    value.widen()
}

fn fixed_float<S: Simd>(value: f32x4<S>) -> (f64x2<S>, f64x2<S>) {
    value.widen()
}

fn native_float<S: Simd>(value: S::f32s) -> (S::f64s, S::f64s) {
    value.widen()
}

Required Associated Types§

Source

type Widened: SimdNarrow<S, Narrowed = Self>

The same-width vector type with lanes twice as wide.

Required Methods§

Source

fn widen(self) -> (Self::Widened, Self::Widened)

Widen every lane, returning the lower and upper halves in that order.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S: Simd> SimdWiden<S> for f32x4<S>

Source§

impl<S: Simd> SimdWiden<S> for f32x8<S>

Source§

impl<S: Simd> SimdWiden<S> for f32x16<S>

Source§

impl<S: Simd> SimdWiden<S> for i8x16<S>

Source§

impl<S: Simd> SimdWiden<S> for i8x32<S>

Source§

impl<S: Simd> SimdWiden<S> for i8x64<S>

Source§

impl<S: Simd> SimdWiden<S> for i16x8<S>

Source§

impl<S: Simd> SimdWiden<S> for i16x16<S>

Source§

impl<S: Simd> SimdWiden<S> for i16x32<S>

Source§

impl<S: Simd> SimdWiden<S> for i32x4<S>

Source§

impl<S: Simd> SimdWiden<S> for i32x8<S>

Source§

impl<S: Simd> SimdWiden<S> for i32x16<S>

Source§

impl<S: Simd> SimdWiden<S> for u8x16<S>

Source§

impl<S: Simd> SimdWiden<S> for u8x32<S>

Source§

impl<S: Simd> SimdWiden<S> for u8x64<S>

Source§

impl<S: Simd> SimdWiden<S> for u16x8<S>

Source§

impl<S: Simd> SimdWiden<S> for u16x16<S>

Source§

impl<S: Simd> SimdWiden<S> for u16x32<S>

Source§

impl<S: Simd> SimdWiden<S> for u32x4<S>

Source§

impl<S: Simd> SimdWiden<S> for u32x8<S>

Source§

impl<S: Simd> SimdWiden<S> for u32x16<S>