pub fn setValue(self: *Self, index: usize, value: bool) void self: *Selfindex: usizevalue: bool429
430
431
432
433
434
435
436 pub fn setValue(self: *Self, index: usize, value: bool) void {
assert(index < bit_length);
if (num_masks == 0) return; // doesn't compile in this case
const bit = maskBit(index);
const mask_index = maskIndex(index);
const new_bit = bit & std.math.boolMask(MaskInt, value);
self.masks[mask_index] = (self.masks[mask_index] & ~bit) | new_bit;
}
Changes the value of the specified bit of the bit set to match the passed boolean.