]> granicus.if.org Git - nethack/commitdiff
comment isqrt
authorcohrs <cohrs>
Mon, 17 Jan 2005 22:24:00 +0000 (22:24 +0000)
committercohrs <cohrs>
Mon, 17 Jan 2005 22:24:00 +0000 (22:24 +0000)
Help code divers to understand why isqrt is not a complicated function.

src/spell.c

index 7cc40985cf983170c32484d73468e71f76ee5964..7d4e22efb4e31a992bff436196b3c89be3578cf0 100644 (file)
@@ -1130,7 +1130,15 @@ int *spell_no;
        return FALSE;
 }
 
-/* Integer square root function without using floating point. */
+/* Integer square root function without using floating point.
+ * This could be replaced by a faster algorithm, but has not because:
+ * + the simple algorithm is easy to read
+ * + this algorithm does not require 64-bit support
+ * + in current usage, the values passed to isqrt() are not really that
+ *   large, so the performance difference is negligible
+ * + isqrt() is used in only one place
+ * + that one place is not the bottle-neck
+ */
 STATIC_OVL int
 isqrt(val)
 int val;