package bitmasks

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Input signature for Make combining Storage with the actual details of a bitmask. See Make for details of its use.

This signature extends the Storage signature with a mask of valid bits and a sum type to represent those bits.

For example, given type t = A | B | C | D | E where A and B correspond to bits 0 and 1, bits 2-4 are unused, C corresponds to bit 5, bits 6-10 are unused, and D and E correspond to bits 11 and 12 then all that is needed is a mask of 0b1100000100011.

include Storage
type storage

The storage type.

val zero : storage

The value for 0.

val one : storage

The value for 1.

val logand : storage -> storage -> storage

The land operator.

val logor : storage -> storage -> storage

The lor operator.

val lognot : storage -> storage

The lnot operator.

val shift_left : storage -> int -> storage

The lsl operator.

val shift_right_logical : storage -> int -> storage

The lsr operator.

val compare : storage -> storage -> int

The compare operator.

val toString : storage -> string

Conversion to string for the storage type.

type t

The (sum) type used for the elements in the bitmask. Constructors may include values, but the bitmask itself will only be over the constant constructors. Using a type whose underlying representation is not an integer will almost certainly cause segfaults. The sum type must have at least as many constant constructors as there are bits in the mask itself.

val mask : storage

Binary mask of valid bits.

OCaml

Innovation. Community. Security.