From a982e6ab8887853eb6d8776485e5b1d80bd0c645 Mon Sep 17 00:00:00 2001 From: Sierraffinity Date: Mon, 4 Jan 2021 16:39:35 -0800 Subject: Make div by zero fix more concice --- gflib/sprite.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'gflib/sprite.c') diff --git a/gflib/sprite.c b/gflib/sprite.c index e36c53721..2616aeaed 100644 --- a/gflib/sprite.c +++ b/gflib/sprite.c @@ -1319,18 +1319,13 @@ void ApplyAffineAnimFrameRelativeAndUpdateMatrix(u8 matrixNum, struct AffineAnim s16 ConvertScaleParam(s16 scale) { - s16 ret; s32 val = 0x10000; // UB: possible division by zero #ifdef UBFIX - if (scale != 0) - ret = val / scale; - else - ret = 0; -#else - ret = val / scale; + if (scale == 0) + return 0; #endif //UBFIX - return ret; + return val / scale; } void GetAffineAnimFrame(u8 matrixNum, struct Sprite *sprite, struct AffineAnimFrameCmd *frameCmd) -- cgit v1.2.3