summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorAndreas Haas <liu.gam3@gmail.com>2017-02-21 23:28:52 +0100
committerAndreas Haas <liu.gam3@gmail.com>2017-02-22 00:56:40 +0100
commit0157969ccc80b05b93d01dd0ea11b40e588437b2 (patch)
tree44bc46d99b6b56dd0e828abe3faf5bd2b228fe74 /scene
parentde0045cf1b0a5e20fbf74da192039d344ee8d0c7 (diff)
Tween: Fix undefined behavior found by static code analyzer.
Adresses the issue mentioned in https://software.intel.com/en-us/articles/the-ultimate-question-of-programming-refactoring-and-everything
Diffstat (limited to 'scene')
-rw-r--r--scene/animation/tween_interpolaters.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/scene/animation/tween_interpolaters.cpp b/scene/animation/tween_interpolaters.cpp
index 5ba9673014..25a27252f5 100644
--- a/scene/animation/tween_interpolaters.cpp
+++ b/scene/animation/tween_interpolaters.cpp
@@ -262,7 +262,8 @@ namespace cubic {
static real_t out(real_t t, real_t b, real_t c, real_t d)
{
- return c * ((t = t / d - 1) * t * t + 1) + b;
+ t = t / d - 1;
+ return c * (t * t * t + 1) + b;
}
static real_t in_out(real_t t, real_t b, real_t c, real_t d)