The unified diff between revisions [4cc7246c..] and [81e4dce2..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'fisqrt.c'

#
# old_revision [4cc7246c1b6c809c9dc15997798f6deed15b3631]
# new_revision [81e4dce274e79dd9187ed4bd182e1d6fc0fdfb37]
#
# add_file "fisqrt.c"
#  content [65553ed1491b6b3d4a266cc821c3f117c623a203]
#
============================================================
--- /dev/null	
+++ fisqrt.c	65553ed1491b6b3d4a266cc821c3f117c623a203
@@ -0,0 +1,18 @@
+/* Implementation of fast inverse square root.
+ * See http://en.wikipedia.org/wiki/Fast_inverse_square_root
+ */
+
+float fisqrt(float n)
+{
+	long i;
+	float x2, y;
+
+	x2 = n * 0.5f;
+	y = n;
+	i = *(long *)&y;
+	i = 0x5f3759df - (i>>1);
+	y = *(float *)&i;
+	y = y * (1.5f - (x2*y*y));
+
+	return y;
+}