#[repr(C, align(16))]pub struct f32x4<S: Simd> {
pub val: [f32; 4],
pub simd: S,
}Fields§
§val: [f32; 4]§simd: SImplementations§
Source§impl<S: Simd> f32x4<S>
impl<S: Simd> f32x4<S>
Sourcepub fn abs(self) -> f32x4<S>
pub fn abs(self) -> f32x4<S>
Examples found in repository?
examples/srgb.rs (line 55)
53fn to_srgb<S: Simd>(simd: S, rgba: [f32; 4]) -> [f32; 4] {
54 let v: f32x4<S> = rgba.simd_into(simd);
55 let vabs = v.abs();
56 let x = vabs - 5.35862651e-04;
57 let x2 = x * x;
58 let even1 = x * -9.12795913e-01 + -2.88143143e-02;
59 let even2 = x2 * -7.29192910e-01 + even1;
60 let odd1 = x * 1.06133172e+00 + 1.40194533e+00;
61 let odd2 = x2 * 2.07758287e-01 + odd1;
62 let poly = odd2 * x.sqrt() + even2;
63 let lin = vabs * 12.92;
64 let z = vabs.simd_gt(0.0031308).select(poly, lin);
65 let z_signed = z.copysign(v);
66 let result = copy_alpha(z_signed, v);
67 result.into()
68}pub fn neg(self) -> f32x4<S>
Sourcepub fn sqrt(self) -> f32x4<S>
pub fn sqrt(self) -> f32x4<S>
Examples found in repository?
More examples
examples/srgb.rs (line 62)
53fn to_srgb<S: Simd>(simd: S, rgba: [f32; 4]) -> [f32; 4] {
54 let v: f32x4<S> = rgba.simd_into(simd);
55 let vabs = v.abs();
56 let x = vabs - 5.35862651e-04;
57 let x2 = x * x;
58 let even1 = x * -9.12795913e-01 + -2.88143143e-02;
59 let even2 = x2 * -7.29192910e-01 + even1;
60 let odd1 = x * 1.06133172e+00 + 1.40194533e+00;
61 let odd2 = x2 * 2.07758287e-01 + odd1;
62 let poly = odd2 * x.sqrt() + even2;
63 let lin = vabs * 12.92;
64 let z = vabs.simd_gt(0.0031308).select(poly, lin);
65 let z_signed = z.copysign(v);
66 let result = copy_alpha(z_signed, v);
67 result.into()
68}pub fn add(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
pub fn sub(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
pub fn mul(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
pub fn div(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
Sourcepub fn copysign(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
pub fn copysign(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
Examples found in repository?
examples/srgb.rs (line 65)
53fn to_srgb<S: Simd>(simd: S, rgba: [f32; 4]) -> [f32; 4] {
54 let v: f32x4<S> = rgba.simd_into(simd);
55 let vabs = v.abs();
56 let x = vabs - 5.35862651e-04;
57 let x2 = x * x;
58 let even1 = x * -9.12795913e-01 + -2.88143143e-02;
59 let even2 = x2 * -7.29192910e-01 + even1;
60 let odd1 = x * 1.06133172e+00 + 1.40194533e+00;
61 let odd2 = x2 * 2.07758287e-01 + odd1;
62 let poly = odd2 * x.sqrt() + even2;
63 let lin = vabs * 12.92;
64 let z = vabs.simd_gt(0.0031308).select(poly, lin);
65 let z_signed = z.copysign(v);
66 let result = copy_alpha(z_signed, v);
67 result.into()
68}pub fn simd_eq(self, rhs: impl SimdInto<Self, S>) -> mask32x4<S>
pub fn simd_lt(self, rhs: impl SimdInto<Self, S>) -> mask32x4<S>
pub fn simd_le(self, rhs: impl SimdInto<Self, S>) -> mask32x4<S>
pub fn simd_ge(self, rhs: impl SimdInto<Self, S>) -> mask32x4<S>
Sourcepub fn simd_gt(self, rhs: impl SimdInto<Self, S>) -> mask32x4<S>
pub fn simd_gt(self, rhs: impl SimdInto<Self, S>) -> mask32x4<S>
Examples found in repository?
examples/srgb.rs (line 64)
53fn to_srgb<S: Simd>(simd: S, rgba: [f32; 4]) -> [f32; 4] {
54 let v: f32x4<S> = rgba.simd_into(simd);
55 let vabs = v.abs();
56 let x = vabs - 5.35862651e-04;
57 let x2 = x * x;
58 let even1 = x * -9.12795913e-01 + -2.88143143e-02;
59 let even2 = x2 * -7.29192910e-01 + even1;
60 let odd1 = x * 1.06133172e+00 + 1.40194533e+00;
61 let odd2 = x2 * 2.07758287e-01 + odd1;
62 let poly = odd2 * x.sqrt() + even2;
63 let lin = vabs * 12.92;
64 let z = vabs.simd_gt(0.0031308).select(poly, lin);
65 let z_signed = z.copysign(v);
66 let result = copy_alpha(z_signed, v);
67 result.into()
68}pub fn max(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
pub fn max_precise(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
pub fn min(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
pub fn min_precise(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
pub fn floor(self) -> f32x4<S>
pub fn fract(self) -> f32x4<S>
pub fn trunc(self) -> f32x4<S>
pub fn combine(self, rhs: impl SimdInto<Self, S>) -> f32x8<S>
pub fn reinterpret_f64(self) -> f64x2<S>
pub fn reinterpret_i32(self) -> i32x4<S>
pub fn reinterpret_u8(self) -> u8x16<S>
pub fn reinterpret_u32(self) -> u32x4<S>
pub fn cvt_u32(self) -> u32x4<S>
pub fn cvt_i32(self) -> i32x4<S>
Trait Implementations§
Source§impl<S: Simd> AddAssign<f32> for f32x4<S>
impl<S: Simd> AddAssign<f32> for f32x4<S>
Source§fn add_assign(&mut self, rhs: f32)
fn add_assign(&mut self, rhs: f32)
Performs the
+= operation. Read moreSource§impl<S: Simd> AddAssign for f32x4<S>
impl<S: Simd> AddAssign for f32x4<S>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl<S: Simd> DivAssign<f32> for f32x4<S>
impl<S: Simd> DivAssign<f32> for f32x4<S>
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
Performs the
/= operation. Read moreSource§impl<S: Simd> DivAssign for f32x4<S>
impl<S: Simd> DivAssign for f32x4<S>
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/= operation. Read moreSource§impl<S: Simd> MulAssign<f32> for f32x4<S>
impl<S: Simd> MulAssign<f32> for f32x4<S>
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*= operation. Read moreSource§impl<S: Simd> MulAssign for f32x4<S>
impl<S: Simd> MulAssign for f32x4<S>
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl<S: Simd> SimdBase<f32, S> for f32x4<S>
impl<S: Simd> SimdBase<f32, S> for f32x4<S>
Source§impl<S: Simd> SimdCvtFloat<i32x4<S>> for f32x4<S>
impl<S: Simd> SimdCvtFloat<i32x4<S>> for f32x4<S>
fn float_from(x: i32x4<S>) -> Self
Source§impl<S: Simd> SimdCvtFloat<u32x4<S>> for f32x4<S>
impl<S: Simd> SimdCvtFloat<u32x4<S>> for f32x4<S>
fn float_from(x: u32x4<S>) -> Self
Source§impl<S: Simd> SimdCvtTruncate<f32x4<S>> for i32x4<S>
impl<S: Simd> SimdCvtTruncate<f32x4<S>> for i32x4<S>
fn truncate_from(x: f32x4<S>) -> Self
Source§impl<S: Simd> SimdCvtTruncate<f32x4<S>> for u32x4<S>
impl<S: Simd> SimdCvtTruncate<f32x4<S>> for u32x4<S>
fn truncate_from(x: f32x4<S>) -> Self
Source§impl<S: Simd> SimdFloat<f32, S> for f32x4<S>
impl<S: Simd> SimdFloat<f32, S> for f32x4<S>
fn abs(self) -> f32x4<S>
fn sqrt(self) -> f32x4<S>
fn copysign(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
fn simd_eq(self, rhs: impl SimdInto<Self, S>) -> mask32x4<S>
fn simd_lt(self, rhs: impl SimdInto<Self, S>) -> mask32x4<S>
fn simd_le(self, rhs: impl SimdInto<Self, S>) -> mask32x4<S>
fn simd_ge(self, rhs: impl SimdInto<Self, S>) -> mask32x4<S>
fn simd_gt(self, rhs: impl SimdInto<Self, S>) -> mask32x4<S>
fn zip_low(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
fn zip_high(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
fn unzip_low(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
fn unzip_high(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
fn max(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
fn max_precise(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
fn min(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
fn min_precise(self, rhs: impl SimdInto<Self, S>) -> f32x4<S>
fn madd( self, op1: impl SimdInto<Self, S>, op2: impl SimdInto<Self, S>, ) -> f32x4<S>
fn msub( self, op1: impl SimdInto<Self, S>, op2: impl SimdInto<Self, S>, ) -> f32x4<S>
fn floor(self) -> f32x4<S>
fn fract(self) -> f32x4<S>
fn trunc(self) -> f32x4<S>
fn to_int<T: SimdCvtTruncate<Self>>(self) -> T
Source§impl<S: Simd> SubAssign<f32> for f32x4<S>
impl<S: Simd> SubAssign<f32> for f32x4<S>
Source§fn sub_assign(&mut self, rhs: f32)
fn sub_assign(&mut self, rhs: f32)
Performs the
-= operation. Read moreSource§impl<S: Simd> SubAssign for f32x4<S>
impl<S: Simd> SubAssign for f32x4<S>
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl<S: Copy + Simd> Copy for f32x4<S>
Auto Trait Implementations§
impl<S> Freeze for f32x4<S>where
S: Freeze,
impl<S> RefUnwindSafe for f32x4<S>where
S: RefUnwindSafe,
impl<S> Send for f32x4<S>
impl<S> Sync for f32x4<S>
impl<S> Unpin for f32x4<S>where
S: Unpin,
impl<S> UnwindSafe for f32x4<S>where
S: UnwindSafe,
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