Hardcaml.ConstantRepresentation of variable width Constants and conversion to/from OCaml types.
include Ppx_compare_lib.Comparable.S with type t := tval compare : t Base__Ppx_compare_lib.compareinclude Bin_prot.Binable.S with type t := tval bin_size_t : t Bin_prot.Size.sizerval bin_write_t : t Bin_prot.Write.writerval bin_read_t : t Bin_prot.Read.readerval __bin_read_t__ : ( int -> t ) Bin_prot.Read.readerval bin_writer_t : t Bin_prot.Type_class.writerval bin_reader_t : t Bin_prot.Type_class.readerval bin_t : t Bin_prot.Type_class.tmodule Signedness : sig ... endval empty : tval create : Base.int -> tcreate n create a n bit constant, initialized to hold all 0s.
val width : t -> Base.intBit width of constant
val to_binary_string : t -> Base.stringConvert a constant to a string of '1' and '0' chars.
val to_binary_string_hum : t -> Base.stringSame as to_binary_string but adds '_'s every chars
val to_int : t -> Base.intConvert constant to an int. Bits above Int.num_bits are dropped.
val to_int32 : t -> Base.int32Convert constant to an int32. Bits above Int32.num_bits are dropped.
val to_int64 : t -> Base.int64Convert constant to an int64. Bits above Int64.num_bits are dropped.
val to_int64_array : t -> Base.int64 Base.arrayConvert to array of int64s
val to_z : signedness:Signedness.t -> t -> Hardcaml__.Zarith.Z.tConvert to an arbitrary precision integer.
val to_hex_string : signedness:Signedness.t -> t -> Base.stringConvert to a hex encoded string.
val of_binary_string : Base.string -> tConvert a string containing '1' and '0' characters to a constant. Width is inferred from the strings length.
val of_binary_string_hum : Base.string -> tSame as of_binary_string but allow '_' chars
val of_int : width:Base.int -> Base.int -> tCreate a constant from the given int value.
val of_int32 : width:Base.int -> Base.int32 -> tCreate a constant from the given int32 value
val of_int64 : width:Base.int -> Base.int64 -> tCreate a constant from the given int64 value
val of_int64_array : width:Base.int -> Base.int64 Base.array -> tCreate from an array of int64s
val of_z : width:Base.int -> Hardcaml__.Zarith.Z.t -> tConvert from an arbitrary precision integer.
val of_hex_string :
signedness:Signedness.t ->
width:Base.int ->
Base.string ->
tCreate from a hex encoded string.
val of_octal_string :
signedness:Signedness.t ->
width:Base.int ->
Base.string ->
tCreate from an octal encoded string.
module type Bit = sig ... endmodule Make_bit_list (Bit : Bit) : sig ... endCreate constant conversion functions from lists of some inner Bit.t type.
val of_bit_list : Base.int Base.list -> tval to_bit_list : t -> Base.int Base.listval pp : Base.Formatter.t -> t -> Base.unitmodule Raw : sig ... endConvert to from constants from raw bit patterns stored in strings and bytes. Data is copied and resized as appropriate.