doom: get rid of floating point code for division

This commit is contained in:
cinap_lenrek 2014-05-11 20:24:27 +02:00
parent 17d932eca9
commit 66f76c2821
2 changed files with 1 additions and 18 deletions

View file

@ -60,21 +60,5 @@ FixedDiv
{
if ( (abs(a)>>14) >= abs(b))
return (a^b)<0 ? MININT : MAXINT;
return FixedDiv2 (a,b);
}
fixed_t
FixedDiv2
( fixed_t a,
fixed_t b )
{
double c;
c = ((double)a) / ((double)b) * FRACUNIT;
if (c >= 2147483648.0 || c < -2147483648.0)
I_Error("FixedDiv: divide by zero");
return (fixed_t) c;
return ((long long)a << FRACBITS) / (long long)b;
}

View file

@ -39,7 +39,6 @@ typedef int fixed_t;
fixed_t FixedMul (fixed_t a, fixed_t b);
fixed_t FixedDiv (fixed_t a, fixed_t b);
fixed_t FixedDiv2 (fixed_t a, fixed_t b);