MCPcopy
hub / github.com/RoaringBitmap/roaring / getFastContainerAtIndex

Method getFastContainerAtIndex

roaringarray.go:321–336  ·  view source on GitHub ↗
(i int, needsWriteable bool)

Source from the content-addressed store, hash-verified

319}
320
321func (ra *roaringArray) getFastContainerAtIndex(i int, needsWriteable bool) container {
322 c := ra.getContainerAtIndex(i)
323 switch t := c.(type) {
324 case *arrayContainer:
325 c = t.toBitmapContainer()
326 case *runContainer16:
327 if !t.isFull() {
328 c = t.toBitmapContainer()
329 }
330 case *bitmapContainer:
331 if needsWriteable && ra.needCopyOnWrite[i] {
332 c = ra.containers[i].clone()
333 }
334 }
335 return c
336}
337
338// getUnionedWritableContainer switches behavior for in-place Or
339// depending on whether the container requires a copy on write.

Callers 2

lazyOrOnRangeFunction · 0.80
lazyIOrOnRangeFunction · 0.80

Calls 4

getContainerAtIndexMethod · 0.95
isFullMethod · 0.65
cloneMethod · 0.65
toBitmapContainerMethod · 0.45

Tested by

no test coverage detected