lance_encoding::compression_algo::fastlanes

Trait BitPacking

Source
pub trait BitPacking: FastLanes {
    // Required methods
    unsafe fn unchecked_pack(width: usize, input: &[Self], output: &mut [Self]);
    unsafe fn unchecked_unpack(
        width: usize,
        input: &[Self],
        output: &mut [Self],
    );
}
Expand description

BitPack into a compile-time known bit-width.

Required Methods§

Source

unsafe fn unchecked_pack(width: usize, input: &[Self], output: &mut [Self])

Packs 1024 elements into W bits each, where W is runtime-known instead of compile-time known.

§Safety

The input slice must be of exactly length 1024. The output slice must be of length 1024 * W / T, where T is the bit-width of Self and W is the packed width. These lengths are checked only with debug_assert (i.e., not checked on release builds).

Source

unsafe fn unchecked_unpack(width: usize, input: &[Self], output: &mut [Self])

Unpacks 1024 elements from W bits each, where W is runtime-known instead of compile-time known.

§Safety

The input slice must be of length 1024 * W / T, where T is the bit-width of Self and W is the packed width. The output slice must be of exactly length 1024. These lengths are checked only with debug_assert (i.e., not checked on release builds).

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 BitPacking for u8

Source§

unsafe fn unchecked_pack(width: usize, input: &[Self], output: &mut [Self])

Source§

unsafe fn unchecked_unpack(width: usize, input: &[Self], output: &mut [Self])

Source§

impl BitPacking for u16

Source§

unsafe fn unchecked_pack(width: usize, input: &[Self], output: &mut [Self])

Source§

unsafe fn unchecked_unpack(width: usize, input: &[Self], output: &mut [Self])

Source§

impl BitPacking for u32

Source§

unsafe fn unchecked_pack(width: usize, input: &[Self], output: &mut [Self])

Source§

unsafe fn unchecked_unpack(width: usize, input: &[Self], output: &mut [Self])

Source§

impl BitPacking for u64

Source§

unsafe fn unchecked_pack(width: usize, input: &[Self], output: &mut [Self])

Source§

unsafe fn unchecked_unpack(width: usize, input: &[Self], output: &mut [Self])

Implementors§