pub fn toggleFirstSet(self: *Self) ?usize self: *Self198
199
200
201
202
203
204 pub fn toggleFirstSet(self: *Self) ?usize {
const mask = self.mask;
if (mask == 0) return null;
const index = @ctz(mask);
self.mask = mask & (mask - 1);
return index;
}
Finds the index of the first set bit, and unsets it. If no bits are set, returns null.