summaryrefslogtreecommitdiff
path: root/src/menu
diff options
context:
space:
mode:
authorKEKW555 <152369890+KEKW555@users.noreply.github.com>2024-02-17 11:03:38 +0530
committerGitHub <noreply@github.com>2024-02-16 21:33:38 -0800
commit8170c03e7efeeff52bc4eb59df06692cc463279b (patch)
tree8144a6a7829eb54f44a78c53ad10a5218ea13fef /src/menu
parent1a3f9e05d33ca8c5010f8f35669299a8b760dd49 (diff)
Use standard union for Div Mod (#693)
* Cleanup ui.c div and mod * Cleanup divRem in pauseMenu.c * Add non matchings * Consistent defines * Restore comment
Diffstat (limited to 'src/menu')
-rw-r--r--src/menu/pauseMenu.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/menu/pauseMenu.c b/src/menu/pauseMenu.c
index 8e0cfadf..940ed787 100644
--- a/src/menu/pauseMenu.c
+++ b/src/menu/pauseMenu.c
@@ -1232,26 +1232,14 @@ bool32 sub_080A5F24(void) {
return result;
}
-typedef union {
- struct {
- s32 v1;
- s32 v2;
- } values;
- u64 raw;
-} DoubleReturnValue;
-
void sub_080A5F48(Item item, u32 offset) {
- // this funcitons signature allows the div function to return a u64 (2x 32 bit registers)
- // with the result in one register and the remainder in the other
- typedef u64 DivRem(u32, u32);
-
s32 ammoCount;
s32 onesDigit;
s32 tensDigit;
void* dest;
u16* temp2;
u32 index;
- DoubleReturnValue ret;
+ union SplitDWord divRem;
switch (item) {
case ITEM_BOTTLE1:
@@ -1281,9 +1269,9 @@ void sub_080A5F48(Item item, u32 offset) {
if (ammoCount < 0)
return;
- ret.raw = ((DivRem*)Div)(ammoCount, 10); // by casting to DivRem, we can recover the remainder from the Div call
- onesDigit = ret.values.v2;
- tensDigit = ret.values.v1;
+ divRem = DivAndMod(ammoCount, 10);
+ onesDigit = divRem.HALF.HI;
+ tensDigit = divRem.HALF.LO;
if (tensDigit >= 10)
tensDigit = 9;