diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-05-11 20:24:27 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-05-11 20:24:27 +0200 |
commit | 66f76c28212d3a25d4b039de2ce817fc74c5ca1e (patch) | |
tree | db44ca8dbcf31f75628065110d22c08f71916350 /sys/src/games/doom/m_fixed.c | |
parent | 17d932eca9cb6b5ec1acbb4d27d782b72cdbf806 (diff) |
doom: get rid of floating point code for division
Diffstat (limited to 'sys/src/games/doom/m_fixed.c')
-rw-r--r-- | sys/src/games/doom/m_fixed.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/sys/src/games/doom/m_fixed.c b/sys/src/games/doom/m_fixed.c index cbee4521f..38f08372f 100644 --- a/sys/src/games/doom/m_fixed.c +++ b/sys/src/games/doom/m_fixed.c @@ -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; } |