These functions convert between the abstract flags type and a
bit-vector that is represented as a system word. The interpretation of
the bits is system-dependent, but follows the C language binding for
the host operating system. Note that there is no error checking on the
fromWord function's argument.
represents the union of all flags. Note that this may well be a
superset of the flags value defined in a matching structure. For
example, BIT_FLAGS is used to define the flags specified by the POSIX
standard; a POSIX-conforming operating system may provide additional
flags that will not be defined in the Posix structure but could be set
in the all value.
returns the set of those flags in fl2 that are not
set in fl1, i.e., the set difference fl2 \ fl1. It is equivalent to:
fromWord(SysWord.andb(SysWord.notb (toWord fl1), toWord fl2))
returns true if any of the flags in fl1 is also in
fl2 (i.e., this tests for non-empty intersection).
Discussion
The number of distinct flags in an implementation of the BIT_FLAGS
interface must be less than or equal to the number of bits in the
SysWord.word type. In addition, fromWord o toWord must be the identity
function, and toWord o fromWord must be equivalent to fn w =>
SysWord.andb(w, toWord all)