mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] Changes to mldonkey/src/utils/lib/misc.ml


From: mldonkey-commits
Subject: [Mldonkey-commits] Changes to mldonkey/src/utils/lib/misc.ml
Date: Tue, 05 Jul 2005 08:26:42 -0400

Index: mldonkey/src/utils/lib/misc.ml
diff -u mldonkey/src/utils/lib/misc.ml:1.1 mldonkey/src/utils/lib/misc.ml:1.2
--- mldonkey/src/utils/lib/misc.ml:1.1  Tue Apr 22 22:33:40 2003
+++ mldonkey/src/utils/lib/misc.ml      Tue Jul  5 12:26:40 2005
@@ -20,3 +20,15 @@
 let hexa_digit x =
   if x >= 10 then Char.chr (Char.code 'A' + x - 10)
   else Char.chr (Char.code '0' + x)
+
+let rec octal x =
+  if x < 8 then x else (x mod 10) + 8 * (octal (x / 10))
+
+let int_of_octal_string s =
+  let l = String.length s in
+  let octal_of_char c =
+    int_of_char c - int_of_char '0' in
+  let rec octal_aux acc i =
+    if i < l then octal_aux (acc * 8 + (octal_of_char s.[i])) (i+1)
+    else acc in
+  octal_aux 0 0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]