This adds two new functions to the BitArray interface for efficient access to set bits.
GetSetBits returns the position of bits set in the array. It is provided a position to start from and will fill the buffer with as many set bits as fit. Its implementation is based on TrailingZeros64 from math/bits.
This adds two new functions to the
BitArray
interface for efficient access to set bits.GetSetBits returns the position of bits set in the array. It is provided a position to start from and will fill the buffer with as many set bits as fit. Its implementation is based on
TrailingZeros64
frommath/bits
.Example usage:
Count returns the total number of bits set in the array. Its implementation is based on
OnesCount64
frommath/bits
.Example usage: