package containers

  1. Overview
  2. Docs

Generate efficient bitfields that fit in an integer

type t
val make : ?emit_failure_if_too_wide:bool -> name:string -> unit -> t

Make a new bitfield with the given name.

  • parameter name

    the name of the generated type

  • parameter emit_failure_if_too_wide

    if true, generated code includes a runtime assertion that Sys.int_size is wide enough to support this type

val field_bit : t -> string -> unit
val field_int : t -> width:int -> string -> unit
val total_width : t -> int
val gen_mli : t -> code
val gen_ml : t -> code
OCaml

Innovation. Community. Security.