summaryrefslogtreecommitdiff
path: root/src/utils/fastsqrt.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-11-16 16:21:37 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-11-16 16:21:37 +0100
commit8a458bbf5bc6fcfa66d6e96e0dea1ec20b2fd0d9 (patch)
tree3673af5375cdb7307baff1ce7e32848a26d70714 /src/utils/fastsqrt.h
parent2567ca34a352d594531e53b47f47f54dcb31cb75 (diff)
downloadmana-8a458bbf5bc6fcfa66d6e96e0dea1ec20b2fd0d9.tar.gz
mana-8a458bbf5bc6fcfa66d6e96e0dea1ec20b2fd0d9.tar.bz2
mana-8a458bbf5bc6fcfa66d6e96e0dea1ec20b2fd0d9.tar.xz
mana-8a458bbf5bc6fcfa66d6e96e0dea1ec20b2fd0d9.zip
Got rid of CVS/Subversion $Id$ markers
I don't know why we dealt with these things for so long. Did we ever get anything out of it?
Diffstat (limited to 'src/utils/fastsqrt.h')
-rw-r--r--src/utils/fastsqrt.h50
1 files changed, 24 insertions, 26 deletions
diff --git a/src/utils/fastsqrt.h b/src/utils/fastsqrt.h
index afadb901..78768149 100644
--- a/src/utils/fastsqrt.h
+++ b/src/utils/fastsqrt.h
@@ -1,26 +1,24 @@
-/* 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.
- *
- * $Id$
- */
-
-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);
-}
+/* 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);
+}