package binsec
Install
dune-project
Dependency
Authors
-
AAdel Djoudi
-
BBenjamin Farinier
-
CChakib Foulani
-
DDorian Lesbre
-
FFrédéric Recoules
-
GGuillaume Girol
-
JJosselin Feist
-
LLesly-Ann Daniel
-
MMahmudul Faisal Al Ameen
-
MManh-Dung Nguyen
-
MMathéo Vergnolle
-
MMathilde Ollivier
-
MMatthieu Lemerre
-
NNicolas Bellec
-
OOlivier Nicole
-
RRichard Bonichon
-
RRobin David
-
SSébastien Bardin
-
SSoline Ducousso
-
TTa Thanh Dinh
-
YYaëlle Vinçont
-
YYanis Sellami
Maintainers
Sources
sha256=87d4048c9a90c8a14ee029e77d31032a15427f06416a31938cec8a68394234c4
sha512=6a023d2a5c87c56b0aac489874431d8dcccee1451a072a826190be3a7f75a961688bab95f193f494231744abc3bc9733ab5c809057d36a5e4d24c6c29c369144
doc/binsec/Binsec/Bitvector/index.html
Module Binsec.Bitvector
module type Common = sig ... endBitvector representation
include Common with type t := t and type boolean = bool
val size_of : t -> intcompare t t' returns the structural comparison of t and t'.
The result is not sorted according to the values of t and t', thus, they can be of different sizes.
It is useful for key comparison for structures like `Set` or `Map`.
ucompare t t' returns the comparison of the unsigned values of t and t'.
It is equivalent of Z.compare (value_of t) (value_of t').
The bitvector t and t' should be of the same size.
scompare t t' returns the comparison of the signed values of t and t'.
It is equivalent of Z.compare (signed_of t) (signed_of t').
The bitvector t and t' should be of the same size.
val 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 = bool
val 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 := t
val num_bits : t -> intval get_bit : t -> int -> boolval extract : t -> int Basic_types.interval -> tCreation functions
val 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_bits : string -> tof_bits s cast an ascii string s to its bitvector representation.
val 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.
Printing functions
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