Skip to content

Commit

Permalink
Fixed TestRankList_Range_OutOfBoundsEnd failed
Browse files Browse the repository at this point in the history
  • Loading branch information
werbenhu committed Dec 31, 2024
1 parent 1099404 commit 8e21f17
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ranklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,11 @@ func (sl *RankList[K, V]) Range(start int, end int) []Entry[K, V] {

for i := sl.level - 1; i >= 0; i-- {
for curr.forward[i] != nil {
rank += curr.forward[i].span[i]
if rank >= start {
forwardRank := rank + curr.forward[i].span[i]
if forwardRank >= start {
break
}
rank = forwardRank
curr = curr.forward[i]
}
}
Expand Down

0 comments on commit 8e21f17

Please sign in to comment.