summaryrefslogtreecommitdiff
path: root/sys/src/games
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-05-11 20:24:27 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2014-05-11 20:24:27 +0200
commit66f76c28212d3a25d4b039de2ce817fc74c5ca1e (patch)
treedb44ca8dbcf31f75628065110d22c08f71916350 /sys/src/games
parent17d932eca9cb6b5ec1acbb4d27d782b72cdbf806 (diff)
doom: get rid of floating point code for division
Diffstat (limited to 'sys/src/games')
-rw-r--r--sys/src/games/doom/m_fixed.c18
-rw-r--r--sys/src/games/doom/m_fixed.h1
2 files changed, 1 insertions, 18 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;
}
diff --git a/sys/src/games/doom/m_fixed.h b/sys/src/games/doom/m_fixed.h
index 7cd7c6663..dea19091b 100644
--- a/sys/src/games/doom/m_fixed.h
+++ b/sys/src/games/doom/m_fixed.h
@@ -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);