| ... | @@ -859,6 +859,18 @@ pub const DynamicBitSetUnmanaged = struct { | ... | @@ -859,6 +859,18 @@ pub const DynamicBitSetUnmanaged = struct { |
| 859 | self.masks[maskIndex(index)] &= ~maskBit(index); | 859 | self.masks[maskIndex(index)] &= ~maskBit(index); |
| 860 | } | 860 | } |
| 861 | | 861 | |
| | 862 | /// Set all bits to 0. |
| | 863 | pub fn unsetAll(self: *Self) void { |
| | 864 | const masks_len = numMasks(self.bit_length); |
| | 865 | @memset(self.masks[0..masks_len], 0); |
| | 866 | } |
| | 867 | |
| | 868 | /// Set all bits to 1. |
| | 869 | pub fn setAll(self: *Self) void { |
| | 870 | const masks_len = numMasks(self.bit_length); |
| | 871 | @memset(self.masks[0..masks_len], std.math.maxInt(MaskInt)); |
| | 872 | } |
| | 873 | |
| 862 | /// Flips a specific bit in the bit set | 874 | /// Flips a specific bit in the bit set |
| 863 | pub fn toggle(self: *Self, index: usize) void { | 875 | pub fn toggle(self: *Self, index: usize) void { |
| 864 | assert(index < self.bit_length); | 876 | assert(index < self.bit_length); |