mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] Changes to mldonkey/tools/mld_hash.ml


From: mldonkey-commits
Subject: [Mldonkey-commits] Changes to mldonkey/tools/mld_hash.ml
Date: Wed, 19 Oct 2005 08:43:29 -0400

Index: mldonkey/tools/mld_hash.ml
diff -u mldonkey/tools/mld_hash.ml:1.4 mldonkey/tools/mld_hash.ml:1.5
--- mldonkey/tools/mld_hash.ml:1.4      Tue Oct 18 08:58:49 2005
+++ mldonkey/tools/mld_hash.ml  Wed Oct 19 12:43:27 2005
@@ -27,6 +27,12 @@
 let _b x = _b "Mld_hash" x  
 
 let block_size = 9728000L
+let zero = Int64.zero
+let one = Int64.one
+let (++) = Int64.add
+let (--) = Int64.sub
+let ( ** ) x y = Int64.mul x y
+let ( // ) x y = Int64.div x y
 
 let tiger_block_size = Int64.of_int (1024 * 1024)
 
@@ -89,7 +95,7 @@
   let chunks = 
     let chunks = Array.create nchunks tiger in
     for i = 0 to nchunks - 1 do
-      let begin_pos = tiger_block_size ** i  in
+      let begin_pos = tiger_block_size ** (Int64.of_int i) in
       let end_pos = begin_pos ++ tiger_block_size in
       let end_pos = min end_pos file_size in
       let len = end_pos -- begin_pos in
@@ -129,7 +135,7 @@
     else
     let chunks = String.create (nchunks*16) in
     for i = 0 to nchunks - 1 do
-      let begin_pos = block_size ** i  in
+      let begin_pos = block_size ** (Int64.of_int i) in
       let end_pos = begin_pos ++ block_size in
       let end_pos = min end_pos file_size in
       let len = end_pos -- begin_pos in
@@ -153,7 +159,7 @@
   let file_size = Unix32.getsize64 fd false in
   let nchunks = Int64.to_int (Int64.pred file_size // block_size) + 1 in
   for i = 0 to nchunks - 1 do
-    let begin_pos = block_size ** i  in
+    let begin_pos = block_size ** (Int64.of_int i) in
     let end_pos = begin_pos ++ block_size in
     let end_pos = min end_pos file_size in
     let len = end_pos -- begin_pos in
@@ -224,7 +230,7 @@
   let create_multifile filename size =    
     let rec iter pos size list =
       if size <> zero then
-        let new_size = (size // 2) ++ one in
+        let new_size = (size // (Int64.of_int 2)) ++ one in
         let filename = Printf.sprintf "%d-%Ld" pos new_size in
         iter (pos+1) (size -- new_size) 
         ((filename, new_size) :: list)




reply via email to

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