MCPcopy Create free account
hub / github.com/RoaringBitmap/roaring / Next

Method Next

roaring.go:856–876  ·  view source on GitHub ↗

Next returns the next integer

()

Source from the content-addressed store, hash-verified

854
855// Next returns the next integer
856func (iui *unsetIterator) Next() uint32 {
857 if iui.iter == nil {
858 // We're in an empty container gap
859 x := (uint32(iui.nextKey) << 16) | uint32(iui.emptyContainerVal)
860 iui.emptyContainerVal++
861 if iui.emptyContainerVal == 0 || uint64(iui.nextKey)<<16|uint64(iui.emptyContainerVal) >= iui.end {
862 // Wrapped around or reached end, move to next container
863 iui.nextKey++
864 iui.init()
865 }
866 return x
867 }
868
869 x := uint32(iui.iter.next()) | iui.hs
870 if !iui.iter.hasNext() || uint64(iui.nextKey)<<16|uint64(iui.iter.peekNext()) >= iui.end {
871 iui.nextKey++
872 iui.containerIndex++
873 iui.init()
874 }
875 return x
876}
877
878// PeekNext peeks the next value without advancing the iterator
879func (iui *unsetIterator) PeekNext() uint32 {

Callers

nothing calls this directly

Calls 4

initMethod · 0.95
nextMethod · 0.65
hasNextMethod · 0.65
peekNextMethod · 0.65

Tested by

no test coverage detected