Frama-C API - Z
Extension of Z from Zarith. Fc_internal_z only includes to Zarith.Z module, it is mandatory if we want to call this module Z without shadowing Zarith's module. This solution is a bit ugly and could be replace by root_module in kernel dune file, but this does not work for now...
Previous version of this file did not include Z, so many more functions and operators are available now.
include module type of Fc_internal_z with type t = Fc_internal_z.t
include module type of Z with type t = Z.t with type t = Fc_internal_z.t
type t = Fc_internal_z.tval zero : tval one : tval minus_one : tval of_int : int -> tval of_int32 : int32 -> tval of_int64 : int64 -> tval of_nativeint : nativeint -> tval of_int32_unsigned : int32 -> tval of_int64_unsigned : int64 -> tval of_nativeint_unsigned : nativeint -> tval of_float : float -> tval of_string : string -> tval of_substring : string -> pos:int -> len:int -> tval of_string_base : int -> string -> tval of_substring_base : int -> string -> pos:int -> len:int -> tval numbits : t -> intval trailing_zeros : t -> intval testbit : t -> int -> boolval popcount : t -> intval to_int : t -> intval to_int32 : t -> int32val to_int64 : t -> int64val to_nativeint : t -> nativeintval to_int32_unsigned : t -> int32val to_int64_unsigned : t -> int64val to_nativeint_unsigned : t -> nativeintval to_float : t -> floatval to_string : t -> stringval format : string -> t -> stringval fits_int : t -> boolval fits_int32 : t -> boolval fits_int64 : t -> boolval fits_nativeint : t -> boolval fits_int32_unsigned : t -> boolval fits_int64_unsigned : t -> boolval fits_nativeint_unsigned : t -> boolval print : t -> unitval output : Stdlib.out_channel -> t -> unitval sprint : unit -> t -> stringval bprint : Stdlib.Buffer.t -> t -> unitval pp_print : Stdlib.Format.formatter -> t -> unitval sign : t -> intval is_even : t -> boolval is_odd : t -> boolval seeded_hash : int -> t -> intval probab_prime : t -> int -> intval fac : int -> tval fac2 : int -> tval facM : int -> int -> tval primorial : int -> tval fib : int -> tval lucnum : int -> tval perfect_power : t -> boolval perfect_square : t -> boolval log2 : t -> intval log2up : t -> intval size : t -> intval to_bits : t -> stringval of_bits : string -> tval random_bits : ?rng:Stdlib.Random.State.t -> int -> tval random_bits_gen : fill:(bytes -> int -> int -> unit) -> int -> tval (~$) : int -> tmodule Compare : sig ... endval round_to_float : t -> bool -> floatinclude Datatype.S_with_collections with type t := t
include Datatype.S with type t := t
include Datatype.S_no_copy with type t := t
include Datatype.Ty with type t := t
val packed_descr : Structural_descr.packPacked version of the descriptor.
val reprs : t listList of representants of the descriptor.
val hash : t -> intHash function: same spec than Hashtbl.hash.
val mem_project : (Project_skeleton.t -> bool) -> t -> boolmem_project f x must return true iff there is a value p of type Project.t in x such that f p returns true.
module Set : Datatype.Set with type elt = tmodule Map : Datatype.Map with type key = tmodule Hashtbl : Datatype.Hashtbl with type key = tOperators
module Operators : sig ... endThis module contains all Z operators.
Compare operators are not at top level in Zarith.
Conversions
val to_int_opt : t -> int optionReturns Some i if the number can be converted to an int, or None otherwise.
val to_int32_opt : t -> int32 optionReturns Some i if the number can be converted to an int32, or None otherwise.
val to_int64_opt : t -> int64 optionReturns Some i if the number can be converted to an int64, or None otherwise.
Basic functions, most of them from Z
val two_power_of_int : ?limit:int -> int -> tComputes 2^n. ?limit can be used to raise an Overflow if the exponent is too big. Default value is 1024.
Calls two_power_of_int after converting the argument using to_int. The default value of ?limit is set by two_power_of_int.
Convert the second argument via of_int then call shift_left. This function was previously called shift_left but it was renamed to avoid shadowing Z function.
Convert the second argument via of_int then call shift_right. This function was previously called shift_right but it was renamed to avoid shadowing Z function.
round_up_to_r m r modu is the smallest number n such that n>=m and n = r modulo modu.
round_down_to_r m r modu is the largest number n such that n<=m and n = r modulo modu.
extract_bits ~start ~stop v is a shortcut for extract v pos length where pos and length are computed using start and stop.
Printers
Set a maximum above which big ints will be printed in hexadecimal. A Negative value turns off this option.
val pretty_hex : t Pretty_utils.formatterPrints the integer in hexadecimal format.
val pretty : t Pretty_utils.formatterPrints the integer in either decimal or hexadecimal depending on the value set via set_big_ints_hex.
val pp_bin : ?nbits:int -> ?sep:string -> t Pretty_utils.formatterPrint binary format. Digits are output by blocs of 4 bits separated by ~sep with at least ~nbits total bits. If nbits is non positive, it will be ignored.
Positive values are prefixed with "0b" and negative values are printed as their 2-complement (lnot) with prefix "1b".
val pp_hex : ?nbits:int -> ?sep:string -> t Pretty_utils.formatterPrint hexadecimal format. Digits are output by blocs of 16 bits (4 hex digits) separated by ~sep with at least ~nbits total bits. If nbits is non positive, it will be ignored.
Positive values are prefixed with "0x" and negative values are printed as their 2-complement (lnot) with prefix "1x".
