diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2021-03-29 20:56:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-29 20:56:15 -0400 |
commit | 50e9666e1637b15bd57fd7ee88180e50d2eb5e8c (patch) | |
tree | b1543b6d79695862cb60d686548dd1a996b69e8c /include/global.h | |
parent | dea07dc8656c8fb32f5b389b9f4f9a30fe26e555 (diff) | |
parent | e8b6b4b65e3b53f5fcf83035b9f848c5ef6378bd (diff) |
Merge branch 'master' into doc-introcred
Diffstat (limited to 'include/global.h')
-rw-r--r-- | include/global.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/global.h b/include/global.h index 1992ff819..7806c0b59 100644 --- a/include/global.h +++ b/include/global.h @@ -74,6 +74,14 @@ #define abs(x) (((x) < 0) ? -(x) : (x)) #endif +// 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) +#else +#define SAFE_DIV(a, b) ((a) / (b)) +#endif + // Extracts the upper 16 bits of a 32-bit number #define HIHALF(n) (((n) & 0xFFFF0000) >> 16) @@ -209,7 +217,7 @@ struct PyramidBag struct BerryCrush { - u16 berryCrushResults[4]; + u16 pressingSpeeds[4]; // For the record with each possible group size, 2-5 players u32 berryPowderAmount; u32 unk; }; |