Skip to main content

Packable

Trait Packable 

Source
pub trait Packable:
    Sealed
    + Copy
    + Ord
    + Debug {
    const WIDTH: usize;
    const LANES: usize = _;

    // Required methods
    fn to_u64(self) -> u64;
    fn from_u64(value: u64) -> Self;
}
Expand description

An unsigned integer type that can be bit packed.

Sealed, because the layout constants are only correct for the four widths that divide 1024 into a whole number of lanes, and because every kernel here does its arithmetic in u64 and relies on every implementor fitting in one.

Required Associated Constants§

Source

const WIDTH: usize

Width of the type in bits. T in the module documentation.

Provided Associated Constants§

Source

const LANES: usize = _

How many of these fit in the 1024 bit virtual register, which is how many lanes there are.

Required Methods§

Source

fn to_u64(self) -> u64

Widens to the type the packing arithmetic is done in.

Source

fn from_u64(value: u64) -> Self

Narrows back. The high bits are already known to be zero.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Packable for u8

Source§

const WIDTH: usize

Source§

fn to_u64(self) -> u64

Source§

fn from_u64(value: u64) -> Self

Source§

impl Packable for u16

Source§

const WIDTH: usize

Source§

fn to_u64(self) -> u64

Source§

fn from_u64(value: u64) -> Self

Source§

impl Packable for u32

Source§

const WIDTH: usize

Source§

fn to_u64(self) -> u64

Source§

fn from_u64(value: u64) -> Self

Source§

impl Packable for u64

Source§

const WIDTH: usize

Source§

fn to_u64(self) -> u64

Source§

fn from_u64(value: u64) -> Self

Implementors§