浏览代码

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
Andreas Haas 8 年之前
父节点
当前提交
0157969ccc
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      scene/animation/tween_interpolaters.cpp

+ 2 - 1
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)
 	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)
 	static real_t in_out(real_t t, real_t b, real_t c, real_t d)