summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/math_util.s56
-rw-r--r--ld_script.txt1
-rw-r--r--src/math_util.c24
3 files changed, 24 insertions, 57 deletions
diff --git a/asm/math_util.s b/asm/math_util.s
deleted file mode 100644
index 43a99dad0..000000000
--- a/asm/math_util.s
+++ /dev/null
@@ -1,56 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
- thumb_func_start sub_8151624
-sub_8151624: @ 8151624
- push {lr}
- adds r1, r0, 0
- movs r0, 0x80
- lsls r0, 9
- lsls r1, 16
- asrs r1, 16
- bl __divsi3
- lsls r0, 16
- asrs r0, 16
- pop {r1}
- bx r1
- thumb_func_end sub_8151624
-
- thumb_func_start sub_815163C
-sub_815163C: @ 815163C
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- movs r2, 0x80
- lsls r2, 1
- lsls r2, r0
- lsls r1, 16
- asrs r1, 16
- adds r0, r2, 0
- bl __divsi3
- lsls r0, 16
- asrs r0, 16
- pop {r1}
- bx r1
- thumb_func_end sub_815163C
-
- thumb_func_start sub_815165C
-sub_815165C: @ 815165C
- push {lr}
- adds r2, r0, 0
- ldr r1, _08151674
- ldr r0, _08151670
- asrs r3, r2, 31
- bl __divdi3
- pop {r1}
- bx r1
- .align 2, 0
-_08151670: .4byte 0x00010000
-_08151674: .4byte 0x00000000
- thumb_func_end sub_815165C
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/ld_script.txt b/ld_script.txt
index bf0186b9d..2a33431b9 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -192,7 +192,6 @@ SECTIONS {
src/battle_message.o(.text);
asm/cable_car.o(.text);
src/math_util.o(.text);
- asm/math_util.o(.text);
asm/roulette_util.o(.text);
asm/cable_car_util.o(.text);
src/save.o(.text);
diff --git a/src/math_util.c b/src/math_util.c
index 3eb995d27..83935454a 100644
--- a/src/math_util.c
+++ b/src/math_util.c
@@ -60,3 +60,27 @@ s32 sub_81515FC(s32 x, s32 y)
_x *= 256;
return _x / y;
}
+
+s16 sub_8151624(s16 y)
+{
+ s32 x;
+
+ x = 0x10000;
+ return x / y;
+}
+
+s16 sub_815163C(u8 s, s16 y)
+{
+ s32 x;
+
+ x = 0x100 << s;
+ return x / y;
+}
+
+s32 sub_815165C(s32 y)
+{
+ s64 x;
+
+ x = 0x10000;
+ return x / y;
+}