pokeemerald/src/math_util.c

87 lines
992 B
C
Raw Normal View History

2017-10-28 21:58:07 +02:00
#include "global.h"
s16 sub_8151534(s16 x, s16 y)
{
s32 result;
result = x;
result *= y;
result /= 256;
return result;
}
s16 sub_8151550(u8 s, s16 x, s16 y)
{
s32 result;
result = x;
result *= y;
result /= (1 << s);
return result;
}
s32 sub_8151574(s32 x, s32 y)
{
s64 result;
result = x;
result *= y;
result /= 256;
return result;
}
2017-10-28 22:09:31 +02:00
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;
}
2017-10-28 22:15:36 +02:00
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;
}