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

Method iremoveRange

arraycontainer.go:144–163  ·  view source on GitHub ↗

remove the values in the range [firstOfRange,endx)

(firstOfRange, endx int)

Source from the content-addressed store, hash-verified

142
143// remove the values in the range [firstOfRange,endx)
144func (ac *arrayContainer) iremoveRange(firstOfRange, endx int) container {
145 if firstOfRange >= endx {
146 return ac
147 }
148 indexstart := binarySearch(ac.content, uint16(firstOfRange))
149 if indexstart < 0 {
150 indexstart = -indexstart - 1
151 }
152 indexend := binarySearch(ac.content, uint16(endx-1))
153 if indexend < 0 {
154 indexend = -indexend - 1
155 } else {
156 indexend++
157 }
158 rangelength := indexend - indexstart
159 answer := ac
160 copy(answer.content[indexstart:], ac.content[indexstart+rangelength:])
161 answer.content = answer.content[:ac.getCardinality()-rangelength]
162 return answer
163}
164
165// flip the values in the range [firstOfRange,endx)
166func (ac *arrayContainer) not(firstOfRange, endx int) container {

Callers

nothing calls this directly

Calls 2

getCardinalityMethod · 0.95
binarySearchFunction · 0.85

Tested by

no test coverage detected