add more fast intrinsics
This commit is contained in:
parent
64a4e92dd2
commit
7ec426b5a8
|
@ -4,7 +4,7 @@ use super::*;
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Default)]
|
#[derive(Copy, Clone, Debug, PartialEq, Default)]
|
||||||
pub(crate) struct FastFloat(Float);
|
pub(crate) struct FastFloat(Float);
|
||||||
|
|
||||||
use core::intrinsics::{fadd_fast, fmul_fast};
|
use core::intrinsics::{fadd_fast, fdiv_fast, fmul_fast, fsub_fast};
|
||||||
|
|
||||||
impl core::ops::Mul for FastFloat {
|
impl core::ops::Mul for FastFloat {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
|
@ -58,7 +58,7 @@ impl core::ops::Sub for FastFloat {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn sub(self, o: FastFloat) -> Self::Output {
|
fn sub(self, o: FastFloat) -> Self::Output {
|
||||||
unsafe { Self(fadd_fast(self.0, -o.0)) }
|
unsafe { Self(fsub_fast(self.0, o.0)) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ impl core::ops::Div for FastFloat {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn div(self, o: FastFloat) -> Self::Output {
|
fn div(self, o: FastFloat) -> Self::Output {
|
||||||
Self(self.0 / o.0)
|
unsafe { Self(fdiv_fast(self.0, o.0)) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue