MCPcopy Index your code
hub / github.com/RoaringBitmap/roaring / init

Method init

roaring.go:814–853  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

812}
813
814func (iui *unsetIterator) init() {
815 // Check if we've gone past the end range
816 if uint64(iui.nextKey)<<16 >= iui.end {
817 iui.iter = nil
818 return
819 }
820
821 // Check if we're in an empty container gap
822 if iui.containerIndex >= iui.highlowcontainer.size() ||
823 iui.highlowcontainer.getKeyAtIndex(iui.containerIndex) > uint16(iui.nextKey) {
824 // We're in a gap - iterate through empty container
825 iui.emptyContainerVal = 0
826 // If this container overlaps with start, advance to start
827 if uint64(iui.nextKey)<<16 < iui.start && iui.start < uint64(iui.nextKey+1)<<16 {
828 iui.emptyContainerVal = uint16(iui.start)
829 }
830 iui.iter = nil
831 return
832 }
833
834 // We're in an actual container
835 iui.hs = uint32(iui.nextKey) << 16
836 c := iui.highlowcontainer.getContainerAtIndex(iui.containerIndex)
837 switch t := c.(type) {
838 case *arrayContainer:
839 iui.arrayUnsetIter = *newArrayContainerUnsetIterator(t.content)
840 iui.iter = &iui.arrayUnsetIter
841 case *runContainer16:
842 iui.runUnsetIter = *t.newRunUnsetIterator16()
843 iui.iter = &iui.runUnsetIter
844 case *bitmapContainer:
845 iui.bitmapUnsetIter = *newBitmapContainerUnsetIterator(t)
846 iui.iter = &iui.bitmapUnsetIter
847 }
848
849 // If this container overlaps with start, advance to the low bits of start
850 if uint64(iui.nextKey)<<16 < iui.start && iui.start < uint64(iui.nextKey+1)<<16 {
851 iui.iter.advanceIfNeeded(uint16(iui.start))
852 }
853}
854
855// Next returns the next integer
856func (iui *unsetIterator) Next() uint32 {

Callers 4

HasNextMethod · 0.95
NextMethod · 0.95
AdvanceIfNeededMethod · 0.95
InitializeMethod · 0.95

Calls 7

newRunUnsetIterator16Method · 0.80
advanceIfNeededMethod · 0.65
sizeMethod · 0.45
getKeyAtIndexMethod · 0.45
getContainerAtIndexMethod · 0.45

Tested by

no test coverage detected