summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-04-14 16:44:03 -0600
committerJared Adams <jaxad0127@gmail.com>2009-04-14 16:46:03 -0600
commitdfd6bc3c91c7bd508b5bde820366784bd980a677 (patch)
treedf44a1950dd589cad9eb08345fec5ab2457adba2 /src/utils
parent87d906c4f3529e7ce8f836876292efbfbe765990 (diff)
downloadmana-client-dfd6bc3c91c7bd508b5bde820366784bd980a677.tar.gz
mana-client-dfd6bc3c91c7bd508b5bde820366784bd980a677.tar.bz2
mana-client-dfd6bc3c91c7bd508b5bde820366784bd980a677.tar.xz
mana-client-dfd6bc3c91c7bd508b5bde820366784bd980a677.zip
Start a MathUtils file
It has fast(inv)sqrt and weightedAverage. Also cleanup the last ocmmit a bit.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/fastsqrt.h24
1 files changed, 0 insertions, 24 deletions
diff --git a/src/utils/fastsqrt.h b/src/utils/fastsqrt.h
deleted file mode 100644
index 78768149..00000000
--- a/src/utils/fastsqrt.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* A very fast function to calculate the approximate inverse square root of a
- * floating point value and a helper function that uses it for getting the
- * normal squareroot. For an explanation of the inverse squareroot function
- * read:
- * http://www.math.purdue.edu/~clomont/Math/Papers/2003/InvSqrt.pdf
- *
- * Unfortunately the original creator of this function seems to be unknown.
- */
-
-float fastInvSqrt(float x)
-{
- union { int i; float x; } tmp;
- float xhalf = 0.5f * x;
- tmp.x = x;
- tmp.i = 0x5f375a86 - (tmp.i >> 1);
- x = tmp.x;
- x = x * (1.5f - xhalf * x * x);
- return x;
-}
-
-float fastSqrt(float x)
-{
- return 1.0f / fastInvSqrt(x);
-}