HomeFreeBSD

bitstring(3): Add bitstring traversal macros.

Description

bitstring(3): Add bitstring traversal macros.

The macro bit_foreach() traverses all set bits in the bitstring in the
forward direction, assigning each location in turn to variable.

The macro bit_foreach_at() traverses all set bits in the bitstring in
the forward direction at or after the zero-based bit index, assigning
each location in turn to variable.

The bit_foreach_unset() and bit_foreach_unset_at() macros which
traverses unset bits are implemented for completeness.

Reviewed by: asomers, dougm
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31469

Details

Provenance
wulfAuthored on Aug 16 2021, 8:18 PM
Reviewer
asomers
Differential Revision
D31469: bitstring(3): Add bitstring traversal macros.
Parents
rG9b78891df13d: hms(4): Allow attachment to pointer top level collection.
Branches
Unknown
Tags
Unknown