11.13. Bitfield name traits

The BITFIELD_TRAIT module implements reflection utilities for bitfield types: converting bitfield values to and from human-readable strings, iterating over individual set bits, and constructing bitfield values from string names.

All functions and symbols are in “bitfield_trait” module, use require to get access to it.

require daslib/bitfield_trait

11.13.1. Function annotations

EachBitfieldMacro

This macro converts each(bitfield) to equivalent inline code.

EachBitNameBitfieldMacro

This macro converts each(bitfield) to equivalent inline code.

11.13.2. Iteration

each(argT: auto ): auto

Iterates over the names of a bitfield type, yielding each bit as a bitfield value (1ul << bitIndex).

Arguments:
  • argT : auto

each_bit_name(argT: auto ): auto

Iterates over the names of a bitfield type, yielding each bit name as a string.

Arguments:
  • argT : auto