diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2017-10-28 16:09:31 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2017-10-28 16:09:31 -0400 |
commit | 8613e8a54d1981dc8f204ecae139726144e640ed (patch) | |
tree | d66d812424f765b8b0397f4fd1b47a6374e30b09 /src/math_util.c | |
parent | f57776c74cded4b10f974828c991c095faaa6d67 (diff) |
through sub_81515FC
Diffstat (limited to 'src/math_util.c')
-rw-r--r-- | src/math_util.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/src/math_util.c b/src/math_util.c index f249d0a51..3eb995d27 100644 --- a/src/math_util.c +++ b/src/math_util.c @@ -1,17 +1,5 @@ - -// Includes #include "global.h" -// Static type declarations - -// Static RAM declarations - -// Static ROM declarations - -// .rodata - -// .text - s16 sub_8151534(s16 x, s16 y) { s32 result; @@ -41,3 +29,34 @@ s32 sub_8151574(s32 x, s32 y) result /= 256; return result; } + +s16 sub_81515B0(s16 x, s16 y) +{ + if (y == 0) + { + return 0; + } + return (x << 8) / y; +} + +s16 sub_81515D4(u8 s, s16 x, s16 y) +{ + if (y == 0) + { + return 0; + } + return (x << s) / y; +} + +s32 sub_81515FC(s32 x, s32 y) +{ + s64 _x; + + if (y == 0) + { + return 0; + } + _x = x; + _x *= 256; + return _x / y; +} |