package mopsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=37966e98ffeebcedc09bd6e9b2b81f69
sha512=40d4d826c25f680766c07eccbabdf5e8a4fa023016e8a164e4e4f6b3781c8484dc4df437055721dfd19b9db8fb7fe3b61236c4833186d346fc7204a68d01eaaa
doc/mopsa.mopsa_utils/Mopsa_utils/Bitfields/IntBitfields/index.html
Module Bitfields.IntBitfields
Bitfields - Sequences of bits that can be set, cleared, or unknown
We rely on Zarith for arithmetic operations.
Types
type t_with_bot = t Core.Bot.with_bot
The type of possibly empty bitfields.
module I = ItvUtils.IntItv
module B = ItvUtils.IntBound
module C = CongUtils.IntCong
val is_valid : t -> bool
Every bit in a bitfield must be set, cleared, or both.
Constructors
val of_z_bot : Z.t -> Z.t -> t_with_bot
val cst_int : int -> t
val cst_int64 : int64 -> t
val zero : t
0
val one : t
1
val mone : t
-1
val zero_one : t
0,1
val minf_inf : t
All integers. Indistiguishable from 0,+∞
.
val unsigned : int -> t
Bitfields of unsigned integers with the specified bitsize.
val unsigned8 : t
val unsigned16 : t
val unsigned32 : t
val unsigned64 : t
val of_range_bot : Z.t -> Z.t -> t Core.Bot.with_bot
Bitfield enclosing the range lo,hi
.
val of_bound_bot : B.t -> B.t -> t Core.Bot.with_bot
Bitfield enclosing the range lo,hi
.
Bitfield enclosing the range lo,hi
. Fails with invalid_arg
if the range is empty.
Bitfield enclosing the range lo,hi
. Fails with invalid_arg
if the range is empty.
Predicates
val equal_bot : t_with_bot -> t_with_bot -> bool
val included_bot : t_with_bot -> t_with_bot -> bool
val intersect_bot : t_with_bot -> t_with_bot -> bool
A total ordering on bitfields, returning -1, 0, or 1. Can be used as compare for sets, maps, etc.
val compare_bot : t Core.Bot.with_bot -> t Core.Bot.with_bot -> int
Total ordering on possibly empty bitfields.
val contains_zero : t -> bool
Whether the bifield contains zero.
val contains_one : t -> bool
Whether the bifield contains one.
val contains_nonzero : t -> bool
Whether the bifield contains a non-zero value.
val is_zero : t -> bool
val is_positive : t -> bool
val is_positive_strict : t -> bool
val is_negative_strict : t -> bool
val is_negative : t -> bool
val is_nonzero : t -> bool
Contains only non-zero elements.
val is_minf_inf : t -> bool
The bitfield represents -∞,+∞
.
val is_singleton : t -> bool
Whether the bitfield contains a single element.
val is_bounded : t -> bool
Whether the bitfield contains a finite number of elements.
Printing
val to_string : t -> string
val print : out_channel -> t -> unit
val fprint : Format.formatter -> t -> unit
val to_string_bot : t Core.Bot.with_bot -> string
val print_bot : out_channel -> t Core.Bot.with_bot -> unit
val fprint_bot : Format.formatter -> t Core.Bot.with_bot -> unit
val bprint_bot : Buffer.t -> t Core.Bot.with_bot -> unit
Enumeration
val size : t -> int
Number of elements. Raises an invalid argument if it is unbounded.
List of elements, in increasing order. Raises an invalid argument if it is unbounded.
Set operations
val join_bot : t_with_bot -> t_with_bot -> t_with_bot
val join_list : t list -> t_with_bot
val meet : t -> t -> t_with_bot
Abstract intersection.
val meet_bot : t_with_bot -> t_with_bot -> t_with_bot
val meet_list : t list -> t_with_bot
Forward operations
val to_bool : bool -> bool -> t
Conversion from integer to boolean in 0,1
: maps 0 to 0 (false) and non-zero to 1 (true).
Logical negation. Logical operation use the C semantics: they accept 0 and non-0 respectively as false and true, but they always return 0 and 1 respectively for false and true.
C comparison tests. Returns an interval included in 0,1
(a boolean)
C comparison tests. Returns a boolean if the test may succeed
Unsigned bitshift right: division by a power of 2 with truncation.
Filters
Given two interval aruments, return the arguments assuming that the predicate holds.
val filter_eq : t -> t -> (t * t) Core.Bot.with_bot
val filter_neq : t -> t -> (t * t) Core.Bot.with_bot
val filter_leq : t -> t -> (t * t) Core.Bot.with_bot
val filter_geq : t -> t -> (t * t) Core.Bot.with_bot
val filter_lt : t -> t -> (t * t) Core.Bot.with_bot
val filter_gt : t -> t -> (t * t) Core.Bot.with_bot
Reduction
val meet_inter : t -> I.t -> (t * I.t) Core.Bot.with_bot
Intersects a bitfield with an interval, and returns the set represented both as a bitfield and as an interval. Useful to implement reductions.