mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
check for iterator overflow
This commit is contained in:
parent
cd78dd6fd1
commit
ee95aec91c
1 changed files with 5 additions and 1 deletions
|
|
@ -366,12 +366,16 @@ func (itr *Iterator) Next() uint64 {
|
|||
itr.j++
|
||||
return itr.peek()
|
||||
}
|
||||
|
||||
// Move to the next possible index in the bitmap container.
|
||||
itr.j++
|
||||
|
||||
// Find first non-zero bit in current bitmap, if possible.
|
||||
hb := int(itr.j / 64)
|
||||
|
||||
if hb >= len(c.bitmap) {
|
||||
itr.i, itr.j = itr.i+1, -1
|
||||
continue
|
||||
}
|
||||
lb := c.bitmap[hb] >> (uint(itr.j) % 64)
|
||||
if lb != 0 {
|
||||
itr.j = int(itr.j) + trailingZeroN(lb)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue