Module Hardcaml__.Constant
type t= Hardcaml__.Bits0.t
val compare : t -> t -> Hardcaml__.Import.intval sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
module Signedness : sig ... endval empty : tval create : Hardcaml__.Import.int -> tcreate ncreate anbit constant, initialized to hold all0s.
val width : t -> Hardcaml__.Import.intBit width of constant
val to_binary_string : t -> Hardcaml__.Import.stringConvert a constant to a string of
'1'and'0'chars.
val to_binary_string_hum : t -> Hardcaml__.Import.stringSame as
to_binary_stringbut adds'_'s every chars
val to_int : t -> Hardcaml__.Import.intConvert constant to an
int. Bits aboveInt.num_bitsare dropped.
val to_int32 : t -> Hardcaml__.Import.int32Convert constant to an
int32. Bits aboveInt32.num_bitsare dropped.
val to_int64 : t -> Hardcaml__.Import.int64Convert constant to an
int64. Bits aboveInt64.num_bitsare dropped.
val to_int64_array : t -> Hardcaml__.Import.int64 Hardcaml__.Import.arrayConvert to array of int64s
val to_z : t -> Hardcaml__.Zarith.Z.tConvert to an unsigned arbitrary precision integer.
val to_hex_string : signedness:Signedness.t -> t -> Hardcaml__.Import.stringConvert to a hex encoded string.
val of_binary_string : Hardcaml__.Import.string -> tConvert a string containing
'1'and'0'characters to a constant. Width is inferred from the strings length.
val of_binary_string_hum : Hardcaml__.Import.string -> tSame as
of_binary_stringbut allow'_'chars
val of_int : width:Hardcaml__.Import.int -> Hardcaml__.Import.int -> tCreate a constant from the given
intvalue.
val of_int32 : width:Hardcaml__.Import.int -> Hardcaml__.Import.int32 -> tCreate a constant from the given
int32value
val of_int64 : width:Hardcaml__.Import.int -> Hardcaml__.Import.int64 -> tCreate a constant from the given
int64value
val of_int64_array : width:Hardcaml__.Import.int -> Hardcaml__.Import.int64 Hardcaml__.Import.array -> tCreate from an array of
int64s
val of_z : width:Hardcaml__.Import.int -> Hardcaml__.Zarith.Z.t -> tConvert from an arbitrary precision integer.
val of_hex_string : signedness:Signedness.t -> width:Hardcaml__.Import.int -> Hardcaml__.Import.string -> tCreate from a hex encoded string.
val int_of_hex_char : Hardcaml__.Import.char -> Hardcaml__.Import.intUtility conversion functions to/from hex chars
val hex_char_of_int : Hardcaml__.Import.int -> Hardcaml__.Import.char
module type Bit = sig ... endmodule Make_bit_list : functor (Bit : Bit) -> sig ... endCreate constant conversion functions from lists of some inner
Bit.ttype.
val of_bit_list : Hardcaml__.Import.int Hardcaml__.Import.list -> tval to_bit_list : t -> Hardcaml__.Import.int Hardcaml__.Import.listval pp : Hardcaml__.Import.Formatter.t -> t -> Hardcaml__.Import.unit
Unsafe Operations
val unsafe_to_bytes : t -> Hardcaml__.Import.Bytes.tReturn the underlying
Bytes.trepresentation of the constant. We label as unsafe as the output bytes are not copied. Mutating them should be done with care.
val unsafe_of_bytes : width:Hardcaml__.Import.int -> Hardcaml__.Import.Bytes.t -> tConstruct a constant from the given
Bytes.t. We label as unsafe as the input bytes are not copied. Mutating them should be done with care.The length of the given
Bytes.tmust be rounded up to 64 bits and be the correct size of fitwidthbits or an exception is raised.