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

Method getUnionedWritableContainer

roaringarray.go:341–346  ·  view source on GitHub ↗

getUnionedWritableContainer switches behavior for in-place Or depending on whether the container requires a copy on write. If it does using the non-inplace or() method leads to fewer allocations.

(pos int, other container)

Source from the content-addressed store, hash-verified

339// depending on whether the container requires a copy on write.
340// If it does using the non-inplace or() method leads to fewer allocations.
341func (ra *roaringArray) getUnionedWritableContainer(pos int, other container) container {
342 if ra.needCopyOnWrite[pos] {
343 return ra.getContainerAtIndex(pos).or(other)
344 }
345 return ra.getContainerAtIndex(pos).ior(other)
346}
347
348func (ra *roaringArray) getWritableContainerAtIndex(i int) container {
349 if ra.needCopyOnWrite[i] {

Callers 1

OrMethod · 0.80

Calls 3

getContainerAtIndexMethod · 0.95
orMethod · 0.65
iorMethod · 0.65

Tested by

no test coverage detected