[BitArray] Fix logic error in toggleAll()

D’oh — lucky the test coverage caught this; unlucky that the test wasn’t deterministic, and the chances of this occurring were quite low.
This commit is contained in:
Karoy Lorentey committed 2024-01-31 19:34:36 -08:00
1 parent e27e422927
commit e01391e562
2 files changed
+2 -1

No files matched your search

@@ -166,6 +166,7 @@ extension BitArray {
public mutating func toggleAll(in range: Range<Int>) {
precondition(range.upperBound <= count, "Range out of bounds")
guard !range.isEmpty else { return }
_update { handle in
let words = handle._mutableWords
let start = _BitPosition(range.lowerBound)