This commit is contained in:
Aliaksandr Valialkin 2024-05-15 16:21:00 +02:00
parent 454f781cd1
commit bc72ac0519
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB

View file

@ -126,6 +126,7 @@ func (bm *bitmap) forEachSetBit(f func(idx int) bool) {
if word == 0 { if word == 0 {
continue continue
} }
wordNew := word
for j := 0; j < 64; j++ { for j := 0; j < 64; j++ {
mask := uint64(1) << j mask := uint64(1) << j
if (word & mask) == 0 { if (word & mask) == 0 {
@ -136,9 +137,12 @@ func (bm *bitmap) forEachSetBit(f func(idx int) bool) {
break break
} }
if !f(idx) { if !f(idx) {
a[i] &= ^mask wordNew &= ^mask
} }
} }
if word != wordNew {
a[i] = wordNew
}
} }
} }