Frama-C API - Bit_utils
Some bit manipulations.
val sizeofchar : unit -> Z.tsizeof(char) in bits
val sizeof : Cil_types.typ -> Int_Base.tsizeof ty is the size of ty in bits. This function may return Int_Base.top.
val osizeof : Cil_types.typ -> Int_Base.tosizeof ty is the size of ty in bytes. This function may return Int_Base.top.
val is_signed_int_enum_pointer : Cil_types.typ -> booltrue means that the type is signed.
val signof_typeof_lval : Cil_types.lval -> boolval sizeof_vid : Cil_types.varinfo -> Int_Base.tval sizeof_lval : Cil_types.lval -> Int_Base.tval sizeof_pointed : Cil_types.typ -> Int_Base.tval osizeof_pointed : Cil_types.typ -> Int_Base.tval sizeof_pointed_lval : Cil_types.lval -> Int_Base.tval max_bit_address : unit -> Z.tval max_bit_size : unit -> Z.tval max_byte_address : unit -> Z.tval max_byte_size : unit -> Z.tPretty printing
val pretty_bits : Cil_types.typ -> use_align:bool -> align:Abstract_interp.Rel.t -> rh_size:Z.t -> start:Z.t -> stop:Z.t -> Stdlib.Format.formatter -> bool * Cil_types.typ optionPretty prints a range of bits in a type for the user. Tries to find field names and array indexes, whenever possible.
Mapping from numeric offsets to symbolic ones.
val type_compatible : Cil_types.typ -> Cil_types.typ -> boolComparison of the shape of two types. Attributes are completely ignored.
type offset_match = | MatchType of Cil_types.typ(*Offset that has this type (modulo attributes)
*)| MatchSize of Z.t(*Offset that has a type of this size
*)| MatchFirst(*Return first symbolic offset that matches
*)| MatchLast(*Return the longest offset that matches
*)
We want to find a symbolic offset that corresponds to a numeric one, with one additional criterion:
val find_offset : Cil_types.typ -> offset:Z.t -> offset_match -> Cil_types.offset * Cil_types.typfind_offset typ ~offset ~size finds a subtype t of typ that describes the type of the bits offset..offset+size-1 in typ. May return a subtype of typ, or a type that is a sub-array of an array type in typ. Also returns a Cil_types.offset off that corresponds to offset. (But we do not have the guarantee that typeof(off) == typ, because of sub-arrays.)
