mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-16 07:40:57 +00:00
Make FixedRem less laggy by just using the modulo operator.
This commit is contained in:
parent
96b12f098b
commit
e9771cd7d0
1 changed files with 1 additions and 8 deletions
|
@ -206,14 +206,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedDiv(fixed_t a, fixed_t b)
|
||||||
*/
|
*/
|
||||||
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRem(fixed_t x, fixed_t y)
|
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRem(fixed_t x, fixed_t y)
|
||||||
{
|
{
|
||||||
const boolean n = x < 0;
|
return x % y;
|
||||||
x = abs(x);
|
|
||||||
while (x >= y)
|
|
||||||
x -= y;
|
|
||||||
if (n)
|
|
||||||
return -x;
|
|
||||||
else
|
|
||||||
return x;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief The FixedSqrt function
|
/** \brief The FixedSqrt function
|
||||||
|
|
Loading…
Reference in a new issue