ref: fefdb3318ce6e8fdbd9c82f93186cbc8908661d8
parent: 6912265b9effd14a7aaf6327069be25f93dbd027
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun May 11 16:24:27 EDT 2014
doom: get rid of floating point code for division
--- a/sys/src/games/doom/m_fixed.c
+++ b/sys/src/games/doom/m_fixed.c
@@ -60,21 +60,5 @@
{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;
}
--- a/sys/src/games/doom/m_fixed.h
+++ b/sys/src/games/doom/m_fixed.h
@@ -39,7 +39,6 @@
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);
--
⑨