Skip to main content

PackableField

Trait PackableField 

Source
pub trait PackableField:
    Sized
    + Copy
    + Clone
    + Default {
    type Packed: Add<Output = Self::Packed> + Sub<Output = Self::Packed> + Mul<Output = Self::Packed> + Mul<Self, Output = Self::Packed> + AddAssign + SubAssign + MulAssign + Copy + Clone + Default;

    const WIDTH: usize;

    // Required methods
    fn pack(chunk: &[Self]) -> Self::Packed;
    fn unpack(packed: Self::Packed, output: &mut [Self]);
}
Expand description

A trait linking a Field element to its SIMD packed representation.

Required Associated Constants§

Source

const WIDTH: usize

How many elements fit in one packed vector.

Required Associated Types§

Source

type Packed: Add<Output = Self::Packed> + Sub<Output = Self::Packed> + Mul<Output = Self::Packed> + Mul<Self, Output = Self::Packed> + AddAssign + SubAssign + MulAssign + Copy + Clone + Default

The packed vector type (e.g., PackedBlock128).

Required Methods§

Source

fn pack(chunk: &[Self]) -> Self::Packed

Pack a slice of scalars into a vector. Panics if slice len < WIDTH.

Source

fn unpack(packed: Self::Packed, output: &mut [Self])

Unpack vector back to scalars.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§