|
@@ -34,47 +34,26 @@ pub trait MulAddAssign<A = Self, B = Self> {
|
|
fn mul_add_assign(&mut self, a: A, b: B);
|
|
fn mul_add_assign(&mut self, a: A, b: B);
|
|
}
|
|
}
|
|
|
|
|
|
-#[cfg(feature = "std")]
|
|
|
|
|
|
+#[cfg(any(feature = "std", feature = "libm"))]
|
|
impl MulAdd<f32, f32> for f32 {
|
|
impl MulAdd<f32, f32> for f32 {
|
|
type Output = Self;
|
|
type Output = Self;
|
|
|
|
|
|
#[inline]
|
|
#[inline]
|
|
fn mul_add(self, a: Self, b: Self) -> Self::Output {
|
|
fn mul_add(self, a: Self, b: Self) -> Self::Output {
|
|
- f32::mul_add(self, a, b)
|
|
|
|
|
|
+ <Self as ::Float>::mul_add(self, a, b)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-#[cfg(feature = "std")]
|
|
|
|
|
|
+#[cfg(any(feature = "std", feature = "libm"))]
|
|
impl MulAdd<f64, f64> for f64 {
|
|
impl MulAdd<f64, f64> for f64 {
|
|
type Output = Self;
|
|
type Output = Self;
|
|
|
|
|
|
#[inline]
|
|
#[inline]
|
|
fn mul_add(self, a: Self, b: Self) -> Self::Output {
|
|
fn mul_add(self, a: Self, b: Self) -> Self::Output {
|
|
- f64::mul_add(self, a, b)
|
|
|
|
|
|
+ <Self as ::Float>::mul_add(self, a, b)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-#[cfg(all(not(feature = "std"), feature = "libm"))]
|
|
|
|
-impl MulAdd<f32, f32> for f32 {
|
|
|
|
- type Output = Self;
|
|
|
|
-
|
|
|
|
- #[inline]
|
|
|
|
- fn mul_add(self, a: Self, b: Self) -> Self::Output {
|
|
|
|
- <f32 as ::libm::F32Ext>::mul_add(self, a, b)
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-#[cfg(all(not(feature = "std"), feature = "libm"))]
|
|
|
|
-impl MulAdd<f64, f64> for f64 {
|
|
|
|
- type Output = Self;
|
|
|
|
-
|
|
|
|
- #[inline]
|
|
|
|
- fn mul_add(self, a: Self, b: Self) -> Self::Output {
|
|
|
|
- <f64 as ::libm::F64Ext>::mul_add(self, a, b)
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
macro_rules! mul_add_impl {
|
|
macro_rules! mul_add_impl {
|
|
($trait_name:ident for $($t:ty)*) => {$(
|
|
($trait_name:ident for $($t:ty)*) => {$(
|
|
impl $trait_name for $t {
|
|
impl $trait_name for $t {
|
|
@@ -92,39 +71,22 @@ mul_add_impl!(MulAdd for isize usize i8 u8 i16 u16 i32 u32 i64 u64);
|
|
#[cfg(has_i128)]
|
|
#[cfg(has_i128)]
|
|
mul_add_impl!(MulAdd for i128 u128);
|
|
mul_add_impl!(MulAdd for i128 u128);
|
|
|
|
|
|
-#[cfg(feature = "std")]
|
|
|
|
|
|
+#[cfg(any(feature = "std", feature = "libm"))]
|
|
impl MulAddAssign<f32, f32> for f32 {
|
|
impl MulAddAssign<f32, f32> for f32 {
|
|
#[inline]
|
|
#[inline]
|
|
fn mul_add_assign(&mut self, a: Self, b: Self) {
|
|
fn mul_add_assign(&mut self, a: Self, b: Self) {
|
|
- *self = f32::mul_add(*self, a, b)
|
|
|
|
|
|
+ *self = <Self as ::Float>::mul_add(*self, a, b)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-#[cfg(feature = "std")]
|
|
|
|
|
|
+#[cfg(any(feature = "std", feature = "libm"))]
|
|
impl MulAddAssign<f64, f64> for f64 {
|
|
impl MulAddAssign<f64, f64> for f64 {
|
|
#[inline]
|
|
#[inline]
|
|
fn mul_add_assign(&mut self, a: Self, b: Self) {
|
|
fn mul_add_assign(&mut self, a: Self, b: Self) {
|
|
- *self = f64::mul_add(*self, a, b)
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-#[cfg(all(not(feature = "std"), feature = "libm"))]
|
|
|
|
-impl MulAddAssign<f32, f32> for f32 {
|
|
|
|
- #[inline]
|
|
|
|
- fn mul_add_assign(&mut self, a: Self, b: Self) {
|
|
|
|
- *self = <f32 as ::libm::F32Ext>::mul_add(*self, a, b)
|
|
|
|
|
|
+ *self = <Self as ::Float>::mul_add(*self, a, b)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-#[cfg(all(not(feature = "std"), feature = "libm"))]
|
|
|
|
-impl MulAddAssign<f64, f64> for f64 {
|
|
|
|
- #[inline]
|
|
|
|
- fn mul_add_assign(&mut self, a: Self, b: Self) {
|
|
|
|
- *self = <f64 as ::libm::F64Ext>::mul_add(*self, a, b)
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
macro_rules! mul_add_assign_impl {
|
|
macro_rules! mul_add_assign_impl {
|
|
($trait_name:ident for $($t:ty)*) => {$(
|
|
($trait_name:ident for $($t:ty)*) => {$(
|
|
impl $trait_name for $t {
|
|
impl $trait_name for $t {
|