diff options
author | SatoMew <SatoMew@users.noreply.github.com> | 2018-10-17 19:53:48 +0100 |
---|---|---|
committer | SatoMew <SatoMew@users.noreply.github.com> | 2018-10-17 19:53:48 +0100 |
commit | 2c5ffce6fccf17cf350b39da979ae1a862133e26 (patch) | |
tree | e7b6fa988bf97dced2d44617b86adb943b870e44 /src/math_util.c | |
parent | d05339979e39580b162e618087136bb220a4f20d (diff) |
decompile math_util.c
Diffstat (limited to 'src/math_util.c')
-rw-r--r-- | src/math_util.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/math_util.c b/src/math_util.c new file mode 100644 index 000000000..466a31921 --- /dev/null +++ b/src/math_util.c @@ -0,0 +1,86 @@ +#include "global.h" + +s16 sub_80D8AA0(s16 x, s16 y) +{ + s32 result; + + result = x; + result *= y; + result /= 256; + return result; +} + +s16 sub_80D8ABC(u8 s, s16 x, s16 y) +{ + s32 result; + + result = x; + result *= y; + result /= (1 << s); + return result; +} + +s32 sub_80D8AE0(s32 x, s32 y) +{ + s64 result; + + result = x; + result *= y; + result /= 256; + return result; +} + +s16 sub_80D8B1C(s16 x, s16 y) +{ + if (y == 0) + { + return 0; + } + return (x << 8) / y; +} + +s16 sub_80D8B40(u8 s, s16 x, s16 y) +{ + if (y == 0) + { + return 0; + } + return (x << s) / y; +} + +s32 sub_80D8B68(s32 x, s32 y) +{ + s64 _x; + + if (y == 0) + { + return 0; + } + _x = x; + _x *= 256; + return _x / y; +} + +s16 sub_80D8B90(s16 y) +{ + s32 x; + + x = 0x10000; + return x / y; +} + +s16 sub_80D8BA8(u8 s, s16 y) +{ + s32 x; + + x = 0x100 << s; + return x / y; +} + +s32 sub_80D8BC8(s32 y) +{ + s64 x; + + x = 0x10000; + return x / y; +} |