diff --git a/libraries/lib-time-and-pitch/StaffPad/SimdTypes_sse2.h b/libraries/lib-time-and-pitch/StaffPad/SimdTypes_sse2.h index d8710d270bc9..93f7448208c5 100644 --- a/libraries/lib-time-and-pitch/StaffPad/SimdTypes_sse2.h +++ b/libraries/lib-time-and-pitch/StaffPad/SimdTypes_sse2.h @@ -133,6 +133,12 @@ __finl float_x4 __vecc sqrt(const float_x4 &a) return _mm_sqrt_ps(a.s); } +__finl float __vecc rint(float x) +{ + __m128i A = _mm_cvtps_epi32(_mm_set_ss(x)); + return _mm_cvtss_f32(_mm_cvtepi32_ps(A)); +} + __finl float_x4 __vecc rint(const float_x4 &a) { __m128i A = _mm_cvtps_epi32(a.s); diff --git a/libraries/lib-time-and-pitch/StaffPad/TimeAndPitch.cpp b/libraries/lib-time-and-pitch/StaffPad/TimeAndPitch.cpp index 2c421bb13b39..29e15de86fce 100644 --- a/libraries/lib-time-and-pitch/StaffPad/TimeAndPitch.cpp +++ b/libraries/lib-time-and-pitch/StaffPad/TimeAndPitch.cpp @@ -187,7 +187,8 @@ namespace { // wrap a phase value into -PI..PI inline float _unwrapPhase(float arg) { - return arg - int(arg * 0.15915494309f + 0.5f) * 6.283185307f; + using namespace audio::simd; + return arg - rint(arg * 0.15915494309f) * 6.283185307f; } void _unwrapPhaseVec(float* v, int n)