Skip to content

Commit d255996

Browse files
committed
Try using FMA ops
1 parent 2ee6d9a commit d255996

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/libstd/f32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ impl f32 {
934934
#[unstable(feature = "lerp", issue = "71015")]
935935
#[inline]
936936
pub fn lerp(self, upper: f32, pol: f32) -> f32 {
937-
self * (1_f32 - pol) + upper * pol
937+
unsafe { intrinsics::fmaf32(self, 1_f32 - pol, upper * pol) }
938938
}
939939
}
940940

src/libstd/f64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ impl f64 {
936936
#[unstable(feature = "lerp", issue = "71015")]
937937
#[inline]
938938
pub fn lerp(self, upper: f64, pol: f64) -> f64 {
939-
self * (1_f64 - pol) + upper * pol
939+
unsafe { intrinsics::fmaf64(self, 1_f64 - pol, upper * pol) }
940940
}
941941

942942
// Solaris/Illumos requires a wrapper around log, log2, and log10 functions

0 commit comments

Comments
 (0)