Skip to content

Commit

Permalink
Change Safe Div to explicitly check b != 0
Browse files Browse the repository at this point in the history
  • Loading branch information
DizzyEggg authored Feb 2, 2024
1 parent 5be69b2 commit 132ca1b
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 132ca1b

Please sign in to comment.