Module Containers_codegen.Bitfield
Generate efficient bitfields that fit in an integer
val make : ?emit_failure_if_too_wide:bool -> name:string -> unit -> tMake 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 -> unitfield_bit ty nameadds a field of size1to the bitfieldty, with namename. The generate code will provide get/set for a boolean.
val field_int : t -> width:int -> string -> unitfield_int ty name ~widthadds a field of sizewidthto the bitfield with namename. The accessors will be for integers ofwidthbits, and the setter might assert that the provided integer fits.
val total_width : t -> intTotal width in bits of the given bitfield.