Trait SimdWiden

pub trait SimdWiden<S: Simd>: SimdBase<S, Mask: MaskWiden<S, Widened = <Self::Widened as SimdBase<S>>::Mask>> + Seal

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()
}

Associated Types

type Widened: SimdNarrow<S, Narrowed = Self>;

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

Required Methods

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

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

Implementors