Add SAFE_DIV

This commit is contained in:
GriffinR authored and huderlem committed 2021-03-21 13:43:14 -05:00
1 parent 28aff5b179
commit dfc6ee0e9e
6 files changed
+15 -29

No files matched your search

+1 -6
View File
@@ -1329,12 +1329,7 @@ void ApplyAffineAnimFrameRelativeAndUpdateMatrix(u8 matrixNum, struct AffineAnim
s16 ConvertScaleParam(s16 scale)
{
s32 val = 0x10000;
// UB: possible division by zero
#ifdef UBFIX
if (scale == 0)
return 0;
#endif //UBFIX
return val / scale;
return SAFE_DIV(val, scale);
}
void GetAffineAnimFrame(u8 matrixNum, struct Sprite *sprite, struct AffineAnimFrameCmd *frameCmd)