From 819c1f3249efe26dc8d8092e5b9a6e668b6a4558 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 11 Aug 2015 23:09:08 +0200 Subject: [PATCH] add `CCBV.print` --- src/data/CCBV.ml | 7 +++++++ src/data/CCBV.mli | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/data/CCBV.ml b/src/data/CCBV.ml index ac31693c..aa91dca7 100644 --- a/src/data/CCBV.ml +++ b/src/data/CCBV.ml @@ -300,3 +300,10 @@ let of_seq seq = |> CCList.of_seq |> List.sort CCOrd.compare = CCList.range 0 10 *) +let print out bv = + Format.pp_print_string out "bv {"; + iter bv + (fun _i b -> + Format.pp_print_char out (if b then '1' else '0') + ); + Format.pp_print_string out "}" diff --git a/src/data/CCBV.mli b/src/data/CCBV.mli index f3ffd3bb..2c0b35f0 100644 --- a/src/data/CCBV.mli +++ b/src/data/CCBV.mli @@ -113,3 +113,7 @@ type 'a sequence = ('a -> unit) -> unit val to_seq : t -> int sequence val of_seq : int sequence -> t + +val print : Format.formatter -> t -> unit +(** Print the bitvector + @since NEXT_RELEASE *)