From b476643fe4788133438cdd33b0b597653455f6d4 Mon Sep 17 00:00:00 2001 From: Dmitry Vedenko Date: Thu, 28 Sep 2023 12:23:22 +0300 Subject: [PATCH] MSVC does not inline `rint` This change gives 2x improvement --- libraries/lib-time-and-pitch/StaffPad/TimeAndPitch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/lib-time-and-pitch/StaffPad/TimeAndPitch.cpp b/libraries/lib-time-and-pitch/StaffPad/TimeAndPitch.cpp index bccaceebdc83..2c421bb13b39 100644 --- a/libraries/lib-time-and-pitch/StaffPad/TimeAndPitch.cpp +++ b/libraries/lib-time-and-pitch/StaffPad/TimeAndPitch.cpp @@ -187,7 +187,7 @@ namespace { // wrap a phase value into -PI..PI inline float _unwrapPhase(float arg) { - return arg - std::rint(arg * 0.15915494309f) * 6.283185307f; + return arg - int(arg * 0.15915494309f + 0.5f) * 6.283185307f; } void _unwrapPhaseVec(float* v, int n)