Struct vrl::Vec4f

source ·
pub struct Vec4f(/* private fields */);

Implementations§

source§

impl Vec4f

source

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) };
source

pub unsafe fn store_ptr_aligned(self, addr: *mut f32)

Stores vector into aligned array at given address.

§Safety

Like store_ptr, requires addr to be valid. Unlike store_ptr, requires addr to be divisible by 16, i.e. to be a 16-bytes aligned address.

source

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 Add<Vec4f> for f32

§

type Output = Vec4f

The resulting type after applying the + operator.
source§

fn add(self, rhs: Vec4f) -> Self::Output

Performs the + operation. Read more
source§

impl Add<f32> for Vec4f

§

type Output = Vec4f

The resulting type after applying the + operator.
source§

fn add(self, rhs: f32) -> Self::Output

Performs the + operation. Read more
source§

impl Add for Vec4f

§

type Output = Vec4f

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl<T> AddAssign<T> for Vec4f
where Self: Add<T, Output = Self>,

source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
source§

impl Clone for Vec4f

source§

fn clone(&self) -> Vec4f

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Vec4f

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Vec4f

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Div<Vec4f> for f32

§

type Output = Vec4f

The resulting type after applying the / operator.
source§

fn div(self, rhs: Vec4f) -> Self::Output

Performs the / operation. Read more
source§

impl Div<f32> for Vec4f

§

type Output = Vec4f

The resulting type after applying the / operator.
source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
source§

impl Div for Vec4f

§

type Output = Vec4f

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl<T> DivAssign<T> for Vec4f
where Self: Div<T, Output = Self>,

source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
source§

impl From<&[f32; 4]> for Vec4f

source§

fn from(value: &[f32; 4]) -> Self

Does same as load.

source§

impl From<&Vec4f> for [f32; 4]

source§

fn from(value: &Vec4f) -> Self

Converts to this type from the input type.
source§

impl From<[f32; 4]> for Vec4f

source§

fn from(value: [f32; 4]) -> Self

Converts to this type from the input type.
source§

impl From<Vec4f> for [f32; 4]

source§

fn from(value: Vec4f) -> Self

Converts to this type from the input type.
source§

impl From<Vec4f> for __m128

source§

fn from(original: Vec4f) -> Self

Converts to this type from the input type.
source§

impl From<__m128> for Vec4f

source§

fn from(original: __m128) -> Vec4f

Converts to this type from the input type.
source§

impl Index<usize> for Vec4f

§

type Output = f32

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<usize> for Vec4f

source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl Mul<Vec4f> for f32

§

type Output = Vec4f

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Vec4f) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<f32> for Vec4f

§

type Output = Vec4f

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
source§

impl Mul for Vec4f

§

type Output = Vec4f

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl<T> MulAssign<T> for Vec4f
where Self: Mul<T, Output = Self>,

source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
source§

impl Neg for Vec4f

§

type Output = Vec4f

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl PartialEq for Vec4f

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Product for Vec4f

source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl SIMDBase<4> for Vec4f

§

type Underlying = __m128

Underlying intrinsic type or tuple of types.
§

type Element = f32

Type of a single element of packed vector.
source§

fn broadcast(value: f32) -> Self

Initializes all values of returned vector with a given value. Read more
source§

unsafe fn load_ptr(addr: *const f32) -> Self

Loads vector from an array pointed by addr. addr is not required to be aligned. Read more
source§

unsafe fn store_ptr(self, addr: *mut f32)

Stores vector into array at given address. Read more
source§

fn sum(self) -> f32

Calculates the sum of all elements of vector. Read more
source§

const N: usize = N

Number of elements in vector.
source§

fn load(data: &[Self::Element; N]) -> Self

Loads vector from a given array. Read more
source§

fn load_checked(data: &[Self::Element]) -> Self

Checks that data contains exactly N elements and loads them into vector. Read more
source§

fn load_prefix(data: &[Self::Element]) -> Self

Loads first N elements of data into vector. Read more
source§

fn store(self, array: &mut [Self::Element; N])

Stores vector into given array.
source§

fn store_checked(self, slice: &mut [Self::Element])

Checks that slice contains exactly N elements and stores elements of vector there. Read more
source§

fn store_prefix(self, slice: &mut [Self::Element])

Stores elements of the vector into prefix of slice. Read more
source§

fn extract(self, index: usize) -> Self::Element

Extracts index-th element of the vector. Index 0 corresponds to the “most left” element. Read more
source§

fn extract_wrapping(self, index: usize) -> Self::Element

Extracts index % N-th element of the vector. This corresponds to the original extract function from VCL. Read more
source§

fn extract_const<const INDEX: i32>(self) -> Self::Element

Extracts INDEX-th element of the vector. Does same as extract with compile-time known index. Read more
source§

impl SIMDFloat for Vec4f

source§

fn round(self) -> Self

Rounds values of the vector to the nearest integers. In case of two integers are equally close (i.e. fractional part of a number equals 0.5) the behavior depends on platform. Read more
source§

impl SIMDPartialLoad<f32> for Vec4f

source§

fn load_partial(data: &[f32]) -> Self

Loads first min(N, data.len()) elements of data into vector. Read more
source§

impl SIMDPartialStore<f32> for Vec4f

source§

fn store_partial(&self, slice: &mut [f32])

Stores min(N, slice.len()) elements of vector into prefix of slice. Read more
source§

impl Sub<Vec4f> for f32

§

type Output = Vec4f

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Vec4f) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<f32> for Vec4f

§

type Output = Vec4f

The resulting type after applying the - operator.
source§

fn sub(self, rhs: f32) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for Vec4f

§

type Output = Vec4f

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl<T> SubAssign<T> for Vec4f
where Self: Sub<T, Output = Self>,

source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
source§

impl Sum for Vec4f

source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl Vec4fBase for Vec4f

source§

fn new(v0: f32, v1: f32, v2: f32, v3: f32) -> Self

Initializes elements of returned vector with given values. Read more
source§

impl Copy for Vec4f

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> SIMDFusedCalc for T
where T: SIMDFusedCalcFallback + Arithmetic + Neg<Output = T>,

source§

fn mul_add(self, b: T, c: T) -> T

Multiplies vector by b and adds c to the product. Read more
source§

fn mul_sub(self, b: T, c: T) -> T

Multiplies vector by b ans substracts c from the procuct. Read more
source§

fn nmul_add(self, b: T, c: T) -> T

Multiplies vector by b and substracts the product from c. Read more
source§

fn nmul_sub(self, b: T, c: T) -> T

Multiplies vector by b and substracts the product from -c. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, Rhs, Output> Arithmetic<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output>,

source§

impl<T, Rhs> ArithmeticAssign<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs>,