pub struct Vec4f(/* private fields */);
Implementations§
source§impl Vec4f
impl Vec4f
sourcepub unsafe fn load_ptr_aligned(addr: *const f32) -> Self
pub unsafe fn load_ptr_aligned(addr: *const f32) -> Self
Loads vector from an aligned array pointed by addr
.
§Safety
Like load
, requires addr
to be valid.
Unlike load
, requires addr
to be divisible by 16
, i.e. to be a 16
-bytes aligned address.
§Examples
#[repr(align(16))]
struct AlignedArray([f32; 4]);
let array = AlignedArray([42.0; 4]);
let vec = unsafe { Vec4f::load_ptr_aligned(array.0.as_ptr()) };
assert_eq!(vec, Vec4f::broadcast(42.0));
In the following example zeros
is aligned 2-bytes aligned. Therefore
zeros.as_ptr().byte_add(1)
is an odd address and hence not divisible by 16
.
ⓘ
let zeros = unsafe { std::mem::zeroed::<[u16; 10]>() };
unsafe { Vec4f::load_ptr_aligned(zeros.as_ptr().byte_add(1) as *const f32) };
sourcepub unsafe fn store_ptr_aligned(self, addr: *mut f32)
pub unsafe fn store_ptr_aligned(self, addr: *mut f32)
sourcepub unsafe fn store_ptr_non_temporal(self, addr: *mut f32)
pub unsafe fn store_ptr_non_temporal(self, addr: *mut f32)
Stores vector into aligned array at given address in uncached memory (non-temporal store).
This may be more efficient than store_ptr_aligned
if it is unlikely that stored data will
stay in cache until it is read again, for instance, when storing large blocks of memory.
§Safety
Has same requirements as store_ptr_aligned
: addr
must be valid and
divisible by 16
, i.e. to be a 16-bytes aligned address.
Trait Implementations§
source§impl<T> AddAssign<T> for Vec4fwhere
Self: Add<T, Output = Self>,
impl<T> AddAssign<T> for Vec4fwhere
Self: Add<T, Output = Self>,
source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+=
operation. Read moresource§impl<T> DivAssign<T> for Vec4fwhere
Self: Div<T, Output = Self>,
impl<T> DivAssign<T> for Vec4fwhere
Self: Div<T, Output = Self>,
source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/=
operation. Read moresource§impl<T> MulAssign<T> for Vec4fwhere
Self: Mul<T, Output = Self>,
impl<T> MulAssign<T> for Vec4fwhere
Self: Mul<T, Output = Self>,
source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*=
operation. Read moresource§impl PartialEq for Vec4f
impl PartialEq for Vec4f
source§impl SIMDBase<4> for Vec4f
impl SIMDBase<4> for Vec4f
§type Underlying = __m128
type Underlying = __m128
Underlying intrinsic type or tuple of types.
source§fn broadcast(value: f32) -> Self
fn broadcast(value: f32) -> Self
Initializes all values of returned vector with a given value. Read more
source§unsafe fn store_ptr(self, addr: *mut f32)
unsafe fn store_ptr(self, addr: *mut f32)
Stores vector into array at given address. Read more
source§fn load_checked(data: &[Self::Element]) -> Self
fn load_checked(data: &[Self::Element]) -> Self
source§fn load_prefix(data: &[Self::Element]) -> Self
fn load_prefix(data: &[Self::Element]) -> Self
source§fn store_checked(self, slice: &mut [Self::Element])
fn store_checked(self, slice: &mut [Self::Element])
source§fn store_prefix(self, slice: &mut [Self::Element])
fn store_prefix(self, slice: &mut [Self::Element])
Stores elements of the vector into prefix of
slice
. Read moresource§fn extract_wrapping(self, index: usize) -> Self::Element
fn extract_wrapping(self, index: usize) -> Self::Element
source§impl SIMDPartialLoad<f32> for Vec4f
impl SIMDPartialLoad<f32> for Vec4f
source§fn load_partial(data: &[f32]) -> Self
fn load_partial(data: &[f32]) -> Self
source§impl SIMDPartialStore<f32> for Vec4f
impl SIMDPartialStore<f32> for Vec4f
source§fn store_partial(&self, slice: &mut [f32])
fn store_partial(&self, slice: &mut [f32])
source§impl<T> SubAssign<T> for Vec4fwhere
Self: Sub<T, Output = Self>,
impl<T> SubAssign<T> for Vec4fwhere
Self: Sub<T, Output = Self>,
source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the
-=
operation. Read moreimpl Copy for Vec4f
impl SIMDVector<4> for Vec4f
Auto Trait Implementations§
impl Freeze for Vec4f
impl RefUnwindSafe for Vec4f
impl Send for Vec4f
impl Sync for Vec4f
impl Unpin for Vec4f
impl UnwindSafe for Vec4f
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more