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

Method negateRange

arraycontainer.go:881–912  ·  view source on GitHub ↗
(buffer []uint16, startIndex, lastIndex, startRange, lastRange int)

Source from the content-addressed store, hash-verified

879}
880
881func (ac *arrayContainer) negateRange(buffer []uint16, startIndex, lastIndex, startRange, lastRange int) {
882 // compute the negation into buffer
883 outPos := 0
884 inPos := startIndex // value here always >= valInRange,
885 // until it is exhausted
886 // n.b., we can start initially exhausted.
887
888 valInRange := startRange
889 for ; valInRange < lastRange && inPos <= lastIndex; valInRange++ {
890 if uint16(valInRange) != ac.content[inPos] {
891 buffer[outPos] = uint16(valInRange)
892 outPos++
893 } else {
894 inPos++
895 }
896 }
897
898 // if there are extra items (greater than the biggest
899 // pre-existing one in range), buffer them
900 for ; valInRange < lastRange; valInRange++ {
901 buffer[outPos] = uint16(valInRange)
902 outPos++
903 }
904
905 if outPos != len(buffer) {
906 panic("negateRange: internal bug")
907 }
908
909 for i, item := range buffer {
910 ac.content[i+startIndex] = item
911 }
912}
913
914func (ac *arrayContainer) isFull() bool {
915 return false

Callers 1

inotCloseMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected