diff options
author | Yuri Rubinsky <chaosus89@gmail.com> | 2023-01-02 15:23:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-02 15:23:49 +0300 |
commit | b29bb11a4cb5ffcca6ddcc4d495656f146bfd22a (patch) | |
tree | ab20f709f2bb37e4436ed64ed7844ee95631a451 /core/math | |
parent | 57267709e665f1683e79bd5d3432be2be5db6c1d (diff) | |
parent | b28571ca3e28cfcf86a95453db6da3d54b932102 (diff) |
Merge pull request #70812 from Chaosus/wrapf_optimize
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/math_funcs.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 8dff8e6e7e..a998dece2a 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -453,7 +453,10 @@ public: } static _ALWAYS_INLINE_ double wrapf(double value, double min, double max) { double range = max - min; - double result = is_zero_approx(range) ? min : value - (range * Math::floor((value - min) / range)); + if (is_zero_approx(range)) { + return min; + } + double result = value - (range * Math::floor((value - min) / range)); if (is_equal_approx(result, max)) { return min; } @@ -461,7 +464,10 @@ public: } static _ALWAYS_INLINE_ float wrapf(float value, float min, float max) { float range = max - min; - float result = is_zero_approx(range) ? min : value - (range * Math::floor((value - min) / range)); + if (is_zero_approx(range)) { + return min; + } + float result = value - (range * Math::floor((value - min) / range)); if (is_equal_approx(result, max)) { return min; } |