Skip to content

Commit

Permalink
explain the slice expression
Browse files Browse the repository at this point in the history
  • Loading branch information
gaissmai committed Dec 14, 2024
1 parent 430f974 commit e507c2b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions bitset.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,8 @@ func (b *BitSet) NextSet(i uint) (uint, bool) {
}

// process the following full words until next bit is set
// x < len(b.set), no out-of-bounds panic in following slice expression
x++
if x >= len(b.set) {
return 0, false
}

for idx, word := range b.set[x:] {
if word != 0 {
return uint((x+idx)<<log2WordSize + bits.TrailingZeros64(word)), true
Expand Down Expand Up @@ -570,6 +567,7 @@ func (b *BitSet) NextSetMany(i uint, buffer []uint) (uint, []uint) {
}

// process the following full words
// x < len(b.set), no out-of-bounds panic in following slice expression
x++
for idx, word := range b.set[x:] {
for word != 0 {
Expand Down

0 comments on commit e507c2b

Please sign in to comment.