1 (* 'diskzip' command for intelligently compressing disk images.
2 (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 Unlimited-length fixed-size bitmap type.
23 The only reason we need this is because strings are limited to 16
24 MBytes on 32 bit platforms (which would limit the size of a disk
25 image we could process to around 64 GB, assuming 512 byte sectors).
26 This module hides multiple strings on 32 bit, or a single long
27 string on 64 bit but is very efficient in either case.
29 Also it uses the 'int63' type which makes arithmetic convenient.
34 val create : Int63.t -> t
35 (** Create a bitmap of the given length in bits. *)
37 val set : t -> Int63.t -> unit
39 val clear : t -> Int63.t -> unit
41 val set_bool : t -> Int63.t -> bool -> unit
43 val set_int : t -> Int63.t -> int -> unit
44 (** Treats the integer as a C-like boolean. *)
46 val get : t -> Int63.t -> bool
48 val iter : (Int63.t -> bool -> unit) -> t -> unit
49 (** [iter f bitmap] iterates over the bitmap, calling [f] for each bit. *)
51 val iter_set : (Int63.t -> bool -> bool) -> t -> unit
52 (** [iter_set f bitmap] iterates over the bitmap, calling [f] for each
53 bit. The return value of [f] is used to set or clear the bit