package containers

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

Install

Dune Dependency

Authors

Maintainers

Sources

v2.8.1.tar.gz
md5=d84e09c5d0abc501aa17cd502e31a038
sha512=8b832f4ada6035e80d81be0cfb7bdffb695ec67d465ed6097a144019e2b8a8f909095e78019c3da2d8181cc3cd730cd48f7519e87d3162442562103b7f36aabb

doc/containers.data/CCBitField/index.html

Module CCBitFieldSource

Bit Field

This module defines efficient bitfields up to 30 or 62 bits (depending on the architecture) in a relatively type-safe way.

  module B = CCBitField.Make(struct end);;

  let x = B.mk_field ()
  let y = B.mk_field ()
  let z = B.mk_field ()

  let f = B.empty |> B.set x true |> B.set y true;;

  assert (not (B.get z f)) ;;

  assert (f |> B.set z true |> B.get z);;
Sourceexception TooManyFields

Raised when too many fields are packed into one bitfield.

Sourceexception Frozen

Raised when a frozen bitfield is modified.

Sourceval max_width : int

System-dependent maximum width for a bitfield, typically 30 or 62.

Sourcemodule type S = sig ... end
Sourcemodule Make (X : sig ... end) : S

Create a new bitfield type

OCaml

Innovation. Community. Security.

On This Page
  1. Bit Field