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

Method andBitmap

bitmapcontainer.go:869–883  ·  view source on GitHub ↗
(value2 *bitmapContainer)

Source from the content-addressed store, hash-verified

867}
868
869func (bc *bitmapContainer) andBitmap(value2 *bitmapContainer) container {
870 newcardinality := int(popcntAndSlice(bc.bitmap, value2.bitmap))
871 if newcardinality > arrayDefaultMaxSize {
872 answer := newBitmapContainer()
873 for k := 0; k < len(answer.bitmap); k++ {
874 answer.bitmap[k] = bc.bitmap[k] & value2.bitmap[k]
875 }
876 answer.cardinality = newcardinality
877 return answer
878 }
879 ac := newArrayContainerSize(newcardinality)
880 fillArrayAND(ac.content, bc.bitmap, value2.bitmap)
881 ac.content = ac.content[:newcardinality]
882 return ac
883}
884
885func (bc *bitmapContainer) intersectsArray(value2 *arrayContainer) bool {
886 c := value2.getCardinality()

Callers 1

andMethod · 0.95

Calls 4

newBitmapContainerFunction · 0.85
newArrayContainerSizeFunction · 0.85
fillArrayANDFunction · 0.85
popcntAndSliceFunction · 0.70

Tested by

no test coverage detected