/[mldonkey]/mldonkey/src/utils/lib/misc.ml
ViewVC logotype

Diff of /mldonkey/src/utils/lib/misc.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by simon_mld, Tue Apr 22 22:33:40 2003 UTC revision 1.2 by spiralvoice, Tue Jul 5 12:26:40 2005 UTC
# Line 20  Line 20 
20  let hexa_digit x =  let hexa_digit x =
21    if x >= 10 then Char.chr (Char.code 'A' + x - 10)    if x >= 10 then Char.chr (Char.code 'A' + x - 10)
22    else Char.chr (Char.code '0' + x)    else Char.chr (Char.code '0' + x)
23    
24    let rec octal x =
25      if x < 8 then x else (x mod 10) + 8 * (octal (x / 10))
26    
27    let int_of_octal_string s =
28      let l = String.length s in
29      let octal_of_char c =
30        int_of_char c - int_of_char '0' in
31      let rec octal_aux acc i =
32        if i < l then octal_aux (acc * 8 + (octal_of_char s.[i])) (i+1)
33        else acc in
34      octal_aux 0 0

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26