Module BitfieldDomain.BitfieldArith

Parameters

Signature

include sig ... end
val (&:) : Ints_t.t -> Ints_t.t -> Ints_t.t
val (|:) : Ints_t.t -> Ints_t.t -> Ints_t.t
val (^:) : Ints_t.t -> Ints_t.t -> Ints_t.t
val (!:) : Ints_t.t -> Ints_t.t
val (<<:) : Ints_t.t -> int -> Ints_t.t
val (>>:) : Ints_t.t -> int -> Ints_t.t
val (<:) : Ints_t.t -> Ints_t.t -> bool
val (=:) : Ints_t.t -> Ints_t.t -> bool
val (>:) : Ints_t.t -> Ints_t.t -> bool
val (<>:) : Ints_t.t -> Ints_t.t -> bool
val (+:) : Ints_t.t -> Ints_t.t -> Ints_t.t
val (-:) : Ints_t.t -> Ints_t.t -> Ints_t.t
val (*:) : Ints_t.t -> Ints_t.t -> Ints_t.t
val (/:) : Ints_t.t -> Ints_t.t -> Ints_t.t
val (%:) : Ints_t.t -> Ints_t.t -> Ints_t.t
val (>>.) : Ints_t.t -> int -> Ints_t.t
val zero_mask : Ints_t.t
val one_mask : Ints_t.t
val of_int : Ints_t.t -> Ints_t.t * Ints_t.t
val join : (Ints_t.t * Ints_t.t) -> (Ints_t.t * Ints_t.t) -> Ints_t.t * Ints_t.t
val meet : (Ints_t.t * Ints_t.t) -> (Ints_t.t * Ints_t.t) -> Ints_t.t * Ints_t.t
val one : Ints_t.t * Ints_t.t
val zero : Ints_t.t * Ints_t.t
val bits_known : (Ints_t.t * Ints_t.t) -> Ints_t.t
val bits_invalid : (Ints_t.t * Ints_t.t) -> Ints_t.t
val is_const : (Ints_t.t * Ints_t.t) -> bool
val is_invalid : (Ints_t.t * Ints_t.t) -> bool
val nabla : Ints_t.t -> Ints_t.t -> Ints_t.t
val widen : (Ints_t.t * Ints_t.t) -> (Ints_t.t * Ints_t.t) -> Ints_t.t * Ints_t.t
val lognot : ('a * 'b) -> 'b * 'a
val logxor : (Ints_t.t * Ints_t.t) -> (Ints_t.t * Ints_t.t) -> Ints_t.t * Ints_t.t
val logand : (Ints_t.t * Ints_t.t) -> (Ints_t.t * Ints_t.t) -> Ints_t.t * Ints_t.t
val logor : (Ints_t.t * Ints_t.t) -> (Ints_t.t * Ints_t.t) -> Ints_t.t * Ints_t.t
val bitmask_up_to : int -> Ints_t.t
val min : GoblintCil.Cil.ikind -> (Ints_t.t * Ints_t.t) -> Z.t
val max : GoblintCil.Cil.ikind -> (Ints_t.t * Ints_t.t) -> Z.t
val concretize : (Ints_t.t * Ints_t.t) -> int list
val bit_width_of : GoblintCil.Cil.ikind -> int
val constrain_to_bit_width_of : GoblintCil.Cil.ikind -> (Ints_t.t * Ints_t.t) -> Ints_t.t * Ints_t.t
val join_shifts : (GoblintCil.Cil.ikind -> 'a -> int -> Ints_t.t * Ints_t.t) -> GoblintCil.Cil.ikind -> 'a -> (Ints_t.t * Ints_t.t) -> Ints_t.t * Ints_t.t
val shift_left : GoblintCil.Cil.ikind -> (Ints_t.t * Ints_t.t) -> (Ints_t.t * Ints_t.t) -> Ints_t.t * Ints_t.t
val shift_right : GoblintCil.Cil.ikind -> (Ints_t.t * Ints_t.t) -> (Ints_t.t * Ints_t.t) -> Ints_t.t * Ints_t.t
val nth_bit : Ints_t.t -> int -> Ints_t.t
val is_power_of_two : Ints_t.t -> bool
val has_neg_values : GoblintCil.Cil.ikind -> (Ints_t.t * Ints_t.t) -> bool

Whether any represented value is negative when interpreted using ik. The kind determines signedness and the position of the sign bit, via min. As with min, the bitfield is assumed to be valid for that kind.

val has_neg_values' : ('a * Ints_t.t) -> bool

Whether the infinite sign extension permits negative values. Unlike has_neg_values, this takes no kind: it assumes a valid, correctly sign-extended (or zero-extended unsigned) bitfield and inspects its leading bits instead of interpreting a finite-width sign bit. Leading ones in o allow negative values, whether those bits are known ones or unknown. Thus top satisfies this predicate, unlike has_only_neg_values'. Correctly zero-extended unsigned values do not. The two has_neg_values variants agree when ik matches the kind used to extend the bitfield. This variant is useful for shift counts, whose kind need not match the left operand's kind and is unavailable in the shift interface. Bottom must be handled separately.

val has_only_neg_values : GoblintCil.Cil.ikind -> (Ints_t.t * Ints_t.t) -> bool

Whether all represented values are negative when interpreted using ik. The kind determines signedness and the position of the sign bit, via max. As with max, the bitfield is assumed to be valid for that kind.

val has_only_neg_values' : (Ints_t.t * Ints_t.t) -> bool

Whether the infinite sign extension encodes definitely negative values. Unlike has_only_neg_values, this takes no kind: it assumes a valid, correctly sign-extended bitfield and inspects its leading bits instead of interpreting a finite-width sign bit. Leading zeros in z disallow zero value bits, while leading ones in o allow one value bits. Unknown leading bits (including top) therefore do not satisfy this predicate. For valid, sign-extended signed bitfields, the two predicates agree. This variant is useful for shift counts, whose kind need not match the left operand's kind and is not available in the shift interface.

val may_exceed_shift_count : GoblintCil.Cil.ikind -> ('a * Ints_t.t) -> bool

For a count with no negative possibilities, o is its maximum. ik belongs to the left operand, not the count.