Skip to content

Commit

Permalink
Merge pull request #353 from Oppen/advance_if_needed_micro_optimization
Browse files Browse the repository at this point in the history
Microoptimization for AdvanceIfNeeded
  • Loading branch information
lemire authored Apr 10, 2022
2 parents 0f788a1 + 849c766 commit 09dd292
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions roaring.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,14 @@ func (ii *intIterator) PeekNext() uint32 {

// AdvanceIfNeeded advances as long as the next value is smaller than minval
func (ii *intIterator) AdvanceIfNeeded(minval uint32) {
to := minval >> 16
to := minval & 0xffff0000

for ii.HasNext() && (ii.hs>>16) < to {
for ii.HasNext() && ii.hs < to {
ii.pos++
ii.init()
}

if ii.HasNext() && (ii.hs>>16) == to {
if ii.HasNext() && ii.hs == to {
ii.iter.advanceIfNeeded(lowbits(minval))

if !ii.iter.hasNext() {
Expand Down

0 comments on commit 09dd292

Please sign in to comment.