Binsec.Bitvectormodule type Common = sig ... endBitvector representation
include Common with type t := t and type boolean = boolval size_of : t -> intval hash : t -> intval zero : tval one : tval zeros : int -> tval ones : int -> tval fill : ?lo:int -> ?hi:int -> int -> tfill lo hi n returns a bitvector of size n where bits from lo to hi are set to one. By default, lo is equal to zero and hi is equal to n. Raise Invalid_argument if lo or hi have incoherent values.
val is_zero : t -> boolval is_one : t -> boolis_zero t (resp. is_one t) checks if t is equal to zero (resp. one)
val is_zeros : t -> boolval is_ones : t -> boolval is_fill : t -> boolis_zeros t (resp. is_ones t) checks if it exists n such that t is equal to zeros n (resp. ones n)
val max_ubv : int -> tval max_sbv : int -> tval min_sbv : int -> tmax_ubv n (resp. max_sbv n) returns a bitvector of size n containing the biggest possible unsigned (resp. signed) value for its size
val is_max_ubv : t -> boolval is_max_sbv : t -> boolval is_min_sbv : t -> boolis_max_ubv t (resp. is_max_sbv t) returns true if t is a bitvector containing the biggest possible unsigned (resp. signed) value for its size, or returns false otherwise
include Sigs.COMPARISON
with type t := t
and type boolean = bool
with type boolean = boolval is_neg : t -> boolval is_pos : t -> boolis_neg t (resp. is_pos t) returns true if the signed interpretation of t is strictly negative (resp. strictly positive)
include Sigs.BITWISE with type t := tval num_bits : t -> intval get_bit : t -> int -> boolval extract : t -> int Basic_types.interval -> tval rand : int -> trand sz creates a bitvector of size sz with random value
val of_bool : bool -> tval to_bool : t -> boolval of_char : char -> tval to_char : t -> charval of_int32 : int32 -> tof_int32 n creates a bitvector of size 32 and value n
val to_int32 : t -> int32val of_int64 : int64 -> tof_int64 n creates a bitvector of size 64 and value n
val to_int64 : t -> int64val of_int : size:int -> int -> tval to_int : t -> intval to_uint : t -> intval of_string : string -> tof_string s converts a string s whose format respects (+-)?0xb0-9+ i.e., hex and bin strings
Otherwise raises Invalid_argument
val to_string : t -> stringto_string s converts a bitvector to hexadecimal notation (if size is a multiple of 4) or to binary (otherwise).
val of_hexstring : string -> tof_hexstring is an alias for of_string
val to_bitstring : t -> stringto_bitstring bv returns the binary string representation of bv, i.e., the string "0b"[01]+ with the same value and size as bv.
val to_hexstring : t -> stringto_hexstring bv returns the hex string representation of bv, i.e., the string "0x"[0-9a-f]+ with the same value and size as bv.
val to_asciistring : t -> stringto_asciistring bv returns the ascii string representation of bv.
val pp : Format.formatter -> t -> unitpp ppf bv prints the decimal value of bv into ppf
val pp_hex : Format.formatter -> t -> unitpp_hex ppf bv prints the hexadecimal value of bv into ppf
val pp_hex_or_bin : Format.formatter -> t -> unitpp_hex ppf bv prints the hexadecimal value of bv into ppf if possible, else prints the binary value of bv.
val print : t -> stringprint bv behaves like pp Format.str_formatter bv; Format.flush_str_formatter ()
module Collection : Sigs.Collection with type t := t