]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - mathlib.c
moved ixtable definition and initialization code to mathlib (and added Mathlib_Init...
[xonotic/darkplaces.git] / mathlib.c
index 371bfa8605b54f54671000bb3c453541a8a08268..7fdda6b3a5f22f93441f48b1a25071e71e4a2f97 100644 (file)
--- a/mathlib.c
+++ b/mathlib.c
@@ -26,6 +26,7 @@ void Sys_Error (char *error, ...);
 
 vec3_t vec3_origin = {0,0,0};
 int nanmask = 255<<23;
+float ixtable[4096];
 
 /*-----------------------------------------------------------------*/
 
@@ -888,3 +889,14 @@ int GreatestCommonDivisor (int i1, int i2)
                return GreatestCommonDivisor (i1, i2 % i1);
        }
 }
+
+
+void Mathlib_Init(void)
+{
+       int a;
+
+       // LordHavoc: setup 1.0f / N table for quick recipricols of integers
+       ixtable[0] = 0;
+       for (a = 1;a < 4096;a++)
+               ixtable[a] = 1.0f / a;
+}
\ No newline at end of file