From ac4c340a45b9deabb12246af1f6e6c20c2c5b0c7 Mon Sep 17 00:00:00 2001 From: Chaosus Date: Fri, 13 Apr 2018 13:50:17 +0300 Subject: [PATCH] Small performance fix to wrapf --- core/math/math_funcs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 26e87f009bc..20001bb9a6f 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -215,11 +215,11 @@ public: } static _ALWAYS_INLINE_ double wrapf(double value, double min, double max) { double rng = max - min; - return min + (value - min) - (rng * Math::floor((value - min) / rng)); + return value - (rng * Math::floor((value - min) / rng)); } static _ALWAYS_INLINE_ float wrapf(float value, float min, float max) { float rng = max - min; - return min + (value - min) - (rng * Math::floor((value - min) / rng)); + return value - (rng * Math::floor((value - min) / rng)); } // double only, as these functions are mainly used by the editor and not performance-critical,