summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Roudiere <gilles.roudiere@gmail.com>2018-04-14 15:00:47 +0200
committerGitHub <noreply@github.com>2018-04-14 15:00:47 +0200
commite7445c3d82b60eae2d02e201d21990f0aac096ae (patch)
tree415c78520142bb7e87320364dbb5487e065ac6c0
parenteac2863c25a4c01d99f3af3aa45e1eaa444a1f5f (diff)
parentac4c340a45b9deabb12246af1f6e6c20c2c5b0c7 (diff)
Merge pull request #18170 from Chaosus/improvewrapf
Small performance fix to wrapf
-rw-r--r--core/math/math_funcs.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index 26e87f009b..20001bb9a6 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,