From: Joshua Simmons Date: Fri, 11 Nov 2022 21:53:38 +0000 (+0100) Subject: Add fallback for `round_ties_to_even` SSE4.1 path X-Git-Url: https://git.nega.tv//gitweb.cgi?a=commitdiff_plain;h=d35281efe6664fa06132fc68ba44d938a76cfac7;p=josh%2Fnarcissus Add fallback for `round_ties_to_even` SSE4.1 path --- diff --git a/narcissus-maths/src/lib.rs b/narcissus-maths/src/lib.rs index 2e71ed0..e653a05 100644 --- a/narcissus-maths/src/lib.rs +++ b/narcissus-maths/src/lib.rs @@ -187,6 +187,10 @@ fn round_ties_to_even(x: f32) -> f32 { let x = _mm_round_ss::(x, x); std::arch::x86_64::_mm_cvtss_f32(x) } + + // Incorrect if the rounding mode is changed. + #[cfg(not(target_feature = "sse4.1"))] + x.round() } #[macro_export]