diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:41:43 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 21:57:34 +0200 |
commit | 0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (patch) | |
tree | 198d4ff7665d89307f6ca2469fa38620a9eb1672 /core/math/math_funcs.h | |
parent | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (diff) | |
download | redot-engine-0ee0fa42e6639b6fa474b7cf6afc6b1a78142185.tar.gz |
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
Diffstat (limited to 'core/math/math_funcs.h')
-rw-r--r-- | core/math/math_funcs.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 33a7d602c3..7a9fd60e23 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -232,14 +232,16 @@ public: static _ALWAYS_INLINE_ float range_lerp(float p_value, float p_istart, float p_istop, float p_ostart, float p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); } static _ALWAYS_INLINE_ double smoothstep(double p_from, double p_to, double p_weight) { - if (is_equal_approx(p_from, p_to)) + if (is_equal_approx(p_from, p_to)) { return p_from; + } double x = CLAMP((p_weight - p_from) / (p_to - p_from), 0.0, 1.0); return x * x * (3.0 - 2.0 * x); } static _ALWAYS_INLINE_ float smoothstep(float p_from, float p_to, float p_weight) { - if (is_equal_approx(p_from, p_to)) + if (is_equal_approx(p_from, p_to)) { return p_from; + } float x = CLAMP((p_weight - p_from) / (p_to - p_from), 0.0f, 1.0f); return x * x * (3.0f - 2.0f * x); } @@ -471,10 +473,11 @@ public: if (p_step != 0) { float a = Math::stepify(p_target - p_offset, p_step + p_separation) + p_offset; float b = a; - if (p_target >= 0) + if (p_target >= 0) { b -= p_separation; - else + } else { b += p_step; + } return (Math::abs(p_target - a) < Math::abs(p_target - b)) ? a : b; } return p_target; |