Skip to main content

SimdElement

Trait SimdElement 

Source
pub unsafe trait SimdElement: Sized {
    type Vector: Sized + Copy;

    const VECTOR_LEN: usize;

    // Required methods
    fn is_available() -> bool;
    unsafe fn load(src: *const Self) -> Self::Vector;
    unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector;
    unsafe fn store(dst: *mut Self, src: Self::Vector);
    unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize);
    unsafe fn set(value: Self) -> Self::Vector;
}
Expand description

A trait for types that may be used as SIMD vector elements.

Required Associated Constants§

Source

const VECTOR_LEN: usize

Capacity of Vector

Required Associated Types§

Source

type Vector: Sized + Copy

raw SIMD vector type like __m256i

Required Methods§

Source

fn is_available() -> bool

Returns these SIMD functions are available.

Source

unsafe fn load(src: *const Self) -> Self::Vector

Loads values to raw SIMD vector.

§Safety

Make sure Self::is_available() returns true and length of src is not less than Self::VECTOR_LEN.

Source

unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector

Loads values to raw SIMD vector.

§Safety

Make sure Self::is_available() returns true and length of src is not less than len.

Source

unsafe fn store(dst: *mut Self, src: Self::Vector)

Stores raw SIMD vector to dst.

§Safety

Make sure Self::is_available() returns true and capacity of dst is not less than Self::VECTOR_LEN.

Source

unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize)

Stores raw SIMD vector to dst.

§Safety

Make sure Self::is_available() returns true and capacity of dst is not less than len.

Source

unsafe fn set(value: Self) -> Self::Vector

Creates a raw SIMD vector filled with value.

§Safety

Make sure Self::is_available() returns true.

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 SimdElement for f32

Source§

const VECTOR_LEN: usize = 8

Source§

type Vector = __m256

Source§

fn is_available() -> bool

Source§

unsafe fn load(src: *const Self) -> Self::Vector

Source§

unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector

Source§

unsafe fn store(dst: *mut Self, src: Self::Vector)

Source§

unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize)

Source§

unsafe fn set(value: Self) -> Self::Vector

Source§

impl SimdElement for f64

Source§

const VECTOR_LEN: usize = 4

Source§

type Vector = __m256d

Source§

fn is_available() -> bool

Source§

unsafe fn load(src: *const Self) -> Self::Vector

Source§

unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector

Source§

unsafe fn store(dst: *mut Self, src: Self::Vector)

Source§

unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize)

Source§

unsafe fn set(value: Self) -> Self::Vector

Source§

impl SimdElement for i8

Source§

const VECTOR_LEN: usize = 32

Source§

type Vector = __m256i

Source§

fn is_available() -> bool

Source§

unsafe fn load(src: *const Self) -> Self::Vector

Source§

unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector

Source§

unsafe fn store(dst: *mut Self, src: Self::Vector)

Source§

unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize)

Source§

unsafe fn set(value: Self) -> Self::Vector

Source§

impl SimdElement for i16

Source§

const VECTOR_LEN: usize = 16

Source§

type Vector = __m256i

Source§

fn is_available() -> bool

Source§

unsafe fn load(src: *const Self) -> Self::Vector

Source§

unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector

Source§

unsafe fn store(dst: *mut Self, src: Self::Vector)

Source§

unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize)

Source§

unsafe fn set(value: Self) -> Self::Vector

Source§

impl SimdElement for i32

Source§

const VECTOR_LEN: usize = 8

Source§

type Vector = __m256i

Source§

fn is_available() -> bool

Source§

unsafe fn load(src: *const Self) -> Self::Vector

Source§

unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector

Source§

unsafe fn store(dst: *mut Self, src: Self::Vector)

Source§

unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize)

Source§

unsafe fn set(value: Self) -> Self::Vector

Source§

impl SimdElement for i64

Source§

const VECTOR_LEN: usize = 4

Source§

type Vector = __m256i

Source§

fn is_available() -> bool

Source§

unsafe fn load(src: *const Self) -> Self::Vector

Source§

unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector

Source§

unsafe fn store(dst: *mut Self, src: Self::Vector)

Source§

unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize)

Source§

unsafe fn set(value: Self) -> Self::Vector

Source§

impl SimdElement for u8

Source§

const VECTOR_LEN: usize = 32

Source§

type Vector = __m256i

Source§

fn is_available() -> bool

Source§

unsafe fn load(src: *const Self) -> Self::Vector

Source§

unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector

Source§

unsafe fn store(dst: *mut Self, src: Self::Vector)

Source§

unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize)

Source§

unsafe fn set(value: Self) -> Self::Vector

Source§

impl SimdElement for u16

Source§

const VECTOR_LEN: usize = 16

Source§

type Vector = __m256i

Source§

fn is_available() -> bool

Source§

unsafe fn load(src: *const Self) -> Self::Vector

Source§

unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector

Source§

unsafe fn store(dst: *mut Self, src: Self::Vector)

Source§

unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize)

Source§

unsafe fn set(value: Self) -> Self::Vector

Source§

impl SimdElement for u32

Source§

const VECTOR_LEN: usize = 8

Source§

type Vector = __m256i

Source§

fn is_available() -> bool

Source§

unsafe fn load(src: *const Self) -> Self::Vector

Source§

unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector

Source§

unsafe fn store(dst: *mut Self, src: Self::Vector)

Source§

unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize)

Source§

unsafe fn set(value: Self) -> Self::Vector

Source§

impl SimdElement for u64

Source§

const VECTOR_LEN: usize = 4

Source§

type Vector = __m256i

Source§

fn is_available() -> bool

Source§

unsafe fn load(src: *const Self) -> Self::Vector

Source§

unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector

Source§

unsafe fn store(dst: *mut Self, src: Self::Vector)

Source§

unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize)

Source§

unsafe fn set(value: Self) -> Self::Vector

Implementors§