-
hardcaml
-
-
hardcaml.ppx_deriving_hardcaml0
Library
Module
Module type
Parameter
Class
Class type
Representation of variable width Constants and conversion to/from OCaml types.
type t = Base.Bytes.t
include Ppx_compare_lib.Comparable.S with type t := t
include Sexplib0.Sexpable.S with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> t
val sexp_of_t : t -> Sexplib0.Sexp.t
include Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
This function only needs implementation if t
exposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the variant t
afterwards.
val bin_shape_t : Bin_prot.Shape.t
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_t : t Bin_prot.Type_class.t
module Signedness : sig ... end
val empty : t
val to_binary_string : t -> Base.string
Convert a constant to a string of '1'
and '0'
chars.
val to_binary_string_hum : t -> Base.string
Same as to_binary_string
but adds '_'
s every chars
val to_int32 : t -> Base.int32
Convert constant to an int32
. Bits above Int32.num_bits
are dropped.
val to_int64 : t -> Base.int64
Convert constant to an int64
. Bits above Int64.num_bits
are dropped.
val to_int64_array : t -> Base.int64 Base.array
Convert to array of int64s
val to_z : signedness:Signedness.t -> t -> Z.t
Convert to an arbitrary precision integer.
val to_hex_string : signedness:Signedness.t -> t -> Base.string
Convert to a hex encoded string.
val of_binary_string : Base.string -> t
Convert a string containing '1'
and '0'
characters to a constant. Width is inferred from the strings length.
val of_binary_string_hum : Base.string -> t
Same as of_binary_string
but allow '_'
chars
val of_int32 : width:Base.int -> Base.int32 -> t
Create a constant from the given int32
value
val of_int64 : width:Base.int -> Base.int64 -> t
Create a constant from the given int64
value
val of_int64_array : width:Base.int -> Base.int64 Base.array -> t
Create from an array of int64
s
val of_hex_string :
signedness:Signedness.t ->
width:Base.int ->
Base.string ->
t
Create from a hex encoded string.
val of_octal_string :
signedness:Signedness.t ->
width:Base.int ->
Base.string ->
t
Create from an octal encoded string.
module type Bit = sig ... end
module Make_bit_list (Bit : Bit) : sig ... end
Create constant conversion functions from lists of some inner Bit.t
type.
val pp : Base.Formatter.t -> t -> Base.unit
module Raw : sig ... end
Convert to from constants from raw bit patterns stored in strings and bytes. Data is copied and resized as appropriate.