doom: get rid of floating point code for division
This commit is contained in:
parent
17d932eca9
commit
66f76c2821
2 changed files with 1 additions and 18 deletions
|
@ -60,21 +60,5 @@ FixedDiv
|
||||||
{
|
{
|
||||||
if ( (abs(a)>>14) >= abs(b))
|
if ( (abs(a)>>14) >= abs(b))
|
||||||
return (a^b)<0 ? MININT : MAXINT;
|
return (a^b)<0 ? MININT : MAXINT;
|
||||||
return FixedDiv2 (a,b);
|
return ((long long)a << FRACBITS) / (long long)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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ typedef int fixed_t;
|
||||||
|
|
||||||
fixed_t FixedMul (fixed_t a, fixed_t b);
|
fixed_t FixedMul (fixed_t a, fixed_t b);
|
||||||
fixed_t FixedDiv (fixed_t a, fixed_t b);
|
fixed_t FixedDiv (fixed_t a, fixed_t b);
|
||||||
fixed_t FixedDiv2 (fixed_t a, fixed_t b);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue