From cd6d752217c9ee2af52f55daf1fea73c0da09a84 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Thu, 12 Oct 2017 19:51:21 +0200 Subject: [PATCH 1/2] Fix warning about unsequenced modification of variable Variable t was read and modified without interleaving sequence points, technically undefined behavior. Report by Clang's -Wunsequenced --- src/shapes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shapes.c b/src/shapes.c index 8197735f0..639934695 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -683,5 +683,5 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2) static float EaseCubicInOut(float t, float b, float c, float d) { if ((t/=d/2) < 1) return (c/2*t*t*t + b); - return (c/2*((t-=2)*t*t + 2) + b); -} \ No newline at end of file + return (c/2*((t-2)*t*t + 2) + b); +} From 107294f3e64c0b1c5722f736097adb808aa3a83c Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Fri, 13 Oct 2017 13:55:01 +0200 Subject: [PATCH 2/2] Fix bug, add some whitespace --- src/shapes.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shapes.c b/src/shapes.c index 639934695..0b34f9217 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -682,6 +682,8 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2) // NOTE: Required for DrawLineBezier() static float EaseCubicInOut(float t, float b, float c, float d) { - if ((t/=d/2) < 1) return (c/2*t*t*t + b); - return (c/2*((t-2)*t*t + 2) + b); + if ((t /= 0.5*d) < 1) + return 0.5*c*t*t*t + b; + t -= 2; + return 0.5*c*(t*t*t + 2) + b; }