summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-13 21:09:12 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-13 21:09:12 +0000
commit68f069fea3182c6d5720df03f1d63de38f14c31d (patch)
tree129b4705b644cf1144b3bff3c18fca9e1b83a3b8 /src/utils
parentd3e938c478570be44c497607262fe8ca7145b171 (diff)
downloadMana-68f069fea3182c6d5720df03f1d63de38f14c31d.tar.gz
Mana-68f069fea3182c6d5720df03f1d63de38f14c31d.tar.bz2
Mana-68f069fea3182c6d5720df03f1d63de38f14c31d.tar.xz
Mana-68f069fea3182c6d5720df03f1d63de38f14c31d.zip
Fixed svn properties.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/fastsqrt.h48
-rw-r--r--src/utils/minmax.h94
2 files changed, 71 insertions, 71 deletions
diff --git a/src/utils/fastsqrt.h b/src/utils/fastsqrt.h
index 8da1d354..78768149 100644
--- a/src/utils/fastsqrt.h
+++ b/src/utils/fastsqrt.h
@@ -1,24 +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.
- */
-
-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);
+}
diff --git a/src/utils/minmax.h b/src/utils/minmax.h
index 1add2b7e..27eb2565 100644
--- a/src/utils/minmax.h
+++ b/src/utils/minmax.h
@@ -1,47 +1,47 @@
-/*
- * The Mana World
- * Copyright 2006 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * The Mana World is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * The Mana World is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-/**
- * Returns a random numeric value that is larger than or equal min and smaller
- * than max
- */
-
-template <typename T> struct MinMax
-{
- void set(T min, T max)
- {
- minVal=min; maxVal=max;
- }
-
- void set(T val)
- {
- set(val, val);
- }
-
- T value()
- {
- return (T)(minVal + (maxVal - minVal) * (rand() / ((double) RAND_MAX + 1)));
- }
-
- T minVal;
- T maxVal;
-};
+/*
+ * The Mana World
+ * Copyright 2006 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/**
+ * Returns a random numeric value that is larger than or equal min and smaller
+ * than max
+ */
+
+template <typename T> struct MinMax
+{
+ void set(T min, T max)
+ {
+ minVal=min; maxVal=max;
+ }
+
+ void set(T val)
+ {
+ set(val, val);
+ }
+
+ T value()
+ {
+ return (T)(minVal + (maxVal - minVal) * (rand() / ((double) RAND_MAX + 1)));
+ }
+
+ T minVal;
+ T maxVal;
+};