From b4d400fc24296fdbb666128bbb682fa60dddc8e7 Mon Sep 17 00:00:00 2001 From: Dmitry Vedenko Date: Wed, 4 Oct 2023 22:01:40 +0300 Subject: [PATCH] Fixes `atan2_ps(0, 0)` --- .../lib-time-and-pitch/StaffPad/SimdComplexConversions_sse2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/lib-time-and-pitch/StaffPad/SimdComplexConversions_sse2.h b/libraries/lib-time-and-pitch/StaffPad/SimdComplexConversions_sse2.h index c88b7435420a..787b8886efad 100644 --- a/libraries/lib-time-and-pitch/StaffPad/SimdComplexConversions_sse2.h +++ b/libraries/lib-time-and-pitch/StaffPad/SimdComplexConversions_sse2.h @@ -148,7 +148,7 @@ inline __m128 atan2_ps(__m128 y, __m128 x) pio2_result = _mm_xor_ps(pio2_result, pio2_mask_sign); pio2_result = _mm_and_ps(pio2_mask, pio2_result); - __m128 pi_mask = _mm_and_ps(y_eq_0, x_le_0); + __m128 pi_mask = _mm_and_ps(y_eq_0, x_lt_0); __m128 pi = _mm_set1_ps(cephes_PIF); __m128 pi_result = _mm_and_ps(pi_mask, pi); @@ -170,7 +170,7 @@ inline __m128 atan2_ps(__m128 y, __m128 x) /* select between zero_result, pio2_result and atan_result */ __m128 result = _mm_andnot_ps(zero_mask, pio2_result); - atan_result = _mm_andnot_ps(pio2_mask, atan_result); + atan_result = _mm_andnot_ps(zero_mask, atan_result); atan_result = _mm_andnot_ps(pio2_mask, atan_result); result = _mm_or_ps(result, atan_result); result = _mm_or_ps(result, pi_result);