Skip to content

Commit

Permalink
Merge pull request #1979 from DizzyEggg/patch-2
Browse files Browse the repository at this point in the history
Change Safe Div to explicitly check b != 0
  • Loading branch information
GriffinRichards authored Feb 5, 2024
2 parents 5be69b2 + 132ca1b commit 246f47d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
// Used in cases where division by 0 can occur in the retail version.
// Avoids invalid opcodes on some emulators, and the otherwise UB.
#ifdef UBFIX
#define SAFE_DIV(a, b) ((b) ? (a) / (b) : 0)
#define SAFE_DIV(a, b) (((b) != 0) ? (a) / (b) : 0)
#else
#define SAFE_DIV(a, b) ((a) / (b))
#endif
Expand Down

0 comments on commit 246f47d

Please sign in to comment.