Function findFirstSet [src]
Finds the index of the first set bit.
If no bits are set, returns null.
Prototype
pub fn findFirstSet(self: Self) ?usize
Parameters
self: Self
Source
pub fn findFirstSet(self: Self) ?usize {
var offset: usize = 0;
var mask = self.masks;
while (offset < self.bit_length) {
if (mask[0] != 0) break;
mask += 1;
offset += @bitSizeOf(MaskInt);
} else return null;
return offset + @ctz(mask[0]);
}