flip method
- int? index
Flips the bit at index. If no index is provided, flips all bits.
Implementation
void flip([int? index]) {
if (index != null) {
_checkBounds(index);
final wordIndex = index ~/ 32;
final bitIndex = index % 32;
_words[wordIndex] ^= (1 << bitIndex);
} else {
for (int i = 0; i < _words.length; i++) {
_words[i] = ~_words[i];
}
_clearUnusedBits();
}
}