From 132ca1be145176893efe4ff31e7794cfa890ddc2 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 2 Feb 2024 22:57:02 +0100 Subject: [PATCH] Change Safe Div to explicitly check b != 0 --- include/global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/global.h b/include/global.h index 1ea3b65d64..658af43da7 100644 --- a/include/global.h +++ b/include/global.h @@ -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