package containers

  1. Overview
  2. Docs
A modular, clean and powerful extension of the OCaml standard library

Install

Dune Dependency

Authors

Maintainers

Sources

containers-3.16.tbz
sha256=1e7992cb2e59c0d2290d1b6c3a31531b3f310be6170b8ef3dde17ccd876b5b79
sha512=bb124e69ad0690f88393e18eee499be07761e767593558867aab32f643466b43258ced503170b154ca3b56dbd68987abd6d9438cf473707ec9866511589a5b84

doc/containers.codegen/Containers_codegen/Bitfield/index.html

Module Containers_codegen.BitfieldSource

Generate efficient bitfields that fit in an integer

Sourcetype t
Sourceval 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

Sourceval field_bit : t -> string -> unit

field_bit ty name adds a field of size 1 to the bitfield ty, with name name. The generate code will provide get/set for a boolean.

Sourceval field_int : t -> width:int -> string -> unit

field_int ty name ~width adds a field of size width to the bitfield with name name. The accessors will be for integers of width bits, and the setter might assert that the provided integer fits.

Sourceval total_width : t -> int

Total width in bits of the given bitfield.

Sourceval gen_mli : t -> code

Generate code for the type signature for the given bitfield

Sourceval gen_ml : t -> code

Generate code for the implementation for the given bitfield

OCaml

Innovation. Community. Security.