11.11. Bitfield operator overloads

The BITFIELD_BOOST module provides utility macros for working with bitfield types including conversion between bitfield values and strings, and iteration over set bits.

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

require daslib/bitfield_boost

11.11.1. Bitfield element access

bitfield_boost.auto(TT)&[]&&=(b: auto(TT)&; i: int; v: bool): auto

&& assignment for bitfield bit at index i

Arguments:
  • b : auto(TT)&

  • i : int

  • v : bool

bitfield_boost.auto(TT)&[]=(b: auto(TT)&; i: int; v: bool): auto

set bitfield bit at index i to v

Arguments:
  • b : auto(TT)&

  • i : int

  • v : bool

bitfield_boost.auto(TT)&[]^^=(b: auto(TT)&; i: int; v: bool): auto

toggle bitfield bit at index i if v is true

Arguments:
  • b : auto(TT)&

  • i : int

  • v : bool

bitfield_boost.auto(TT)&[]||=(b: auto(TT)&; i: int; v: bool): auto

|| assignment for bitfield bit at index i

Arguments:
  • b : auto(TT)&

  • i : int

  • v : bool

bitfield_boost.auto[](b: auto; i: int): bool

get bitfield bit at index i

Arguments:
  • b : auto

  • i : int

11.11.2. Iteration

bitfield_boost.each_bit(b: auto): iterator<bool>

Iterates over each bit of a bitfield value, yielding true or false for each bit.

Arguments:
  • b : auto