Change Safe Div to explicitly check b != 0
This commit is contained in:
parent
5be69b2713
commit
132ca1be14
1 changed files with 1 additions and 1 deletions
|
@ -80,7 +80,7 @@
|
||||||
// Used in cases where division by 0 can occur in the retail version.
|
// Used in cases where division by 0 can occur in the retail version.
|
||||||
// Avoids invalid opcodes on some emulators, and the otherwise UB.
|
// Avoids invalid opcodes on some emulators, and the otherwise UB.
|
||||||
#ifdef UBFIX
|
#ifdef UBFIX
|
||||||
#define SAFE_DIV(a, b) ((b) ? (a) / (b) : 0)
|
#define SAFE_DIV(a, b) (((b) != 0) ? (a) / (b) : 0)
|
||||||
#else
|
#else
|
||||||
#define SAFE_DIV(a, b) ((a) / (b))
|
#define SAFE_DIV(a, b) ((a) / (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue