WideUtilsExt

Trait WideUtilsExt 

Source
pub trait WideUtilsExt: Sized {
    type Widened;

    // Required methods
    fn widen_to_u64x8(self) -> Self::Widened;
    fn shuffle(self, indices: Self) -> Self;

    // Provided method
    fn double(self) -> Self
       where Self: Add<Output = Self> + Copy { ... }
}
Expand description

Trait extension for wide SIMD types providing additional utility operations

Required Associated Types§

Source

type Widened

The output type for widening operations

Required Methods§

Source

fn widen_to_u64x8(self) -> Self::Widened

Widen the vector elements to a larger type

Source

fn shuffle(self, indices: Self) -> Self

Shuffle elements according to the given indices (indices are same SIMD type). result[i] = self[indices[i]]

Provided Methods§

Source

fn double(self) -> Self
where Self: Add<Output = Self> + Copy,

Double each element (self + self). Wraps on overflow.

This is the most efficient way to multiply by 2 since addition is well-supported on all SIMD architectures (NEON vaddq, SSE paddq).

For multiply by powers of 2, chain calls:

  • x.double() = x * 2
  • x.double().double() = x * 4
  • x.double().double().double() = x * 8

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl WideUtilsExt for u8x16

Source§

type Widened = ()

Source§

fn widen_to_u64x8(self)

Source§

fn shuffle(self, indices: Self) -> Self

Source§

impl WideUtilsExt for u32x4

Source§

type Widened = u64x4

Source§

fn widen_to_u64x8(self) -> u64x4

Source§

fn shuffle(self, indices: Self) -> Self

Source§

impl WideUtilsExt for u32x8

Source§

type Widened = u64x8

Source§

fn widen_to_u64x8(self) -> u64x8

Source§

fn shuffle(self, indices: Self) -> Self

Implementors§