File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -237,8 +237,22 @@ module DolmenIntf = struct
237237 module Bitv = struct
238238 include DTerm. Bitv
239239
240- let v bv n =
241- let bv = Z. format (Fmt. str " %c0%db" '%' n) (Z. of_string bv) in
240+ let int_to_bitvector n bits =
241+ let two_pow_n = 1 lsl bits in
242+ let unsigned_bv = if n < 0 then two_pow_n + n else n in
243+ let rec to_bitlist acc n bits =
244+ if bits = 0 then acc
245+ else
246+ to_bitlist
247+ (Prelude.String. cat (string_of_int (n land 1 )) acc)
248+ (n lsr 1 ) (bits - 1 )
249+ in
250+ (* let bitlist = to_bitlist [] unsigned_bv bits in
251+ Fmt.str "%a" (Fmt.list Fmt.int) bitlist *)
252+ to_bitlist " " unsigned_bv bits
253+
254+ let v (i : string ) (n : int ) =
255+ let bv = int_to_bitvector (Z. to_int (Z. of_string i)) n in
242256 DTerm.Bitv. mk bv
243257
244258 let lognot = DTerm.Bitv. not
You can’t perform that action at this time.
0 commit comments