pub trait SimdVector: Copy {
const SIZE: usize;
Show 16 methods
// Required methods
fn available() -> bool;
unsafe fn zero() -> Self;
unsafe fn set<const N: usize>(val: [f32; N]) -> Self;
unsafe fn splat_f32(val: f32) -> Self;
unsafe fn load(ptr: *const f32) -> Self;
unsafe fn load_aligned(ptr: *const f32) -> Self;
unsafe fn extract_f32<const N: i32>(self) -> f32;
unsafe fn store(self, ptr: *mut f32);
unsafe fn store_aligned(self, ptr: *mut f32);
unsafe fn add(self, lhs: Self) -> Self;
unsafe fn sub(self, lhs: Self) -> Self;
unsafe fn mul(self, lhs: Self) -> Self;
unsafe fn div(self, lhs: Self) -> Self;
unsafe fn abs(self) -> Self;
unsafe fn muladd(self, mul: Self, add: Self) -> Self;
unsafe fn mulsub(self, mul: Self, sub: Self) -> Self;
}
Expand description
Trait representing a SIMD vector.
Required Associated Constants§
Required Methods§
Sourceunsafe fn load(ptr: *const f32) -> Self
unsafe fn load(ptr: *const f32) -> Self
Load a SIMD vector from memory.
The pointer doesn’t need to be aligned.
§Safety
CPU should support the vector type, and the given pointer must be valid.
Sourceunsafe fn load_aligned(ptr: *const f32) -> Self
unsafe fn load_aligned(ptr: *const f32) -> Self
Load a SIMD vector from memory with aligned pointer.
§Safety
CPU should support the vector type, and the given pointer must be valid and properly aligned.
Sourceunsafe fn extract_f32<const N: i32>(self) -> f32
unsafe fn extract_f32<const N: i32>(self) -> f32
Sourceunsafe fn store(self, ptr: *mut f32)
unsafe fn store(self, ptr: *mut f32)
Store the SIMD vector to memory.
The pointer doesn’t need to be aligned.
§Safety
CPU should support the vector type, and the given pointer must be valid.
Sourceunsafe fn store_aligned(self, ptr: *mut f32)
unsafe fn store_aligned(self, ptr: *mut f32)
Store the SIMD vector to memory with aligned pointer.
§Safety
CPU should support the vector type, and the given pointer must be valid and properly aligned.
Sourceunsafe fn abs(self) -> Self
unsafe fn abs(self) -> Self
Compute the absolute value for each element of the vector.
§Safety
CPU should support the vector type.
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.