22 |
open Unix |
open Unix |
23 |
open Printf2 |
open Printf2 |
24 |
|
|
|
|
|
|
let zero = Int64.zero |
|
|
let one = Int64.one |
|
|
let (++) = Int64.add |
|
|
let (--) = Int64.sub |
|
|
let ( ** ) x y = Int64.mul x (Int64.of_int y) |
|
|
let ( // ) x y = Int64.div x y |
|
|
|
|
|
|
|
25 |
open BTTypes |
open BTTypes |
26 |
|
|
27 |
let announce = ref "" |
let announce = ref "" |
158 |
end; |
end; |
159 |
|
|
160 |
let chunk_size = torrent.torrent_piece_size in |
let chunk_size = torrent.torrent_piece_size in |
161 |
let npieces = 1+ Int64.to_int ((length -- one) // chunk_size) in |
let npieces = 1 + Int64.to_int ((length -- one) // chunk_size) in |
162 |
|
|
163 |
if Array.length torrent.torrent_pieces <> npieces then begin |
if Array.length torrent.torrent_pieces <> npieces then begin |
164 |
Printf.printf "ERROR: computed npieces %d <> torrent npieces %d\n" |
Printf.printf "ERROR: computed npieces %d <> torrent npieces %d\n" |