MCPcopy Create free account
hub / github.com/RoaringBitmap/roaring / AddMany

Method AddMany

roaring64/roaring64.go:961–986  ·  view source on GitHub ↗

AddMany add all of the values in dat

(dat []uint64)

Source from the content-addressed store, hash-verified

959
960// AddMany add all of the values in dat
961func (rb *Bitmap) AddMany(dat []uint64) {
962 if len(dat) == 0 {
963 return
964 }
965
966 start, batchHighBits := 0, highbits(dat[0])
967 for end := 1; end < len(dat); end++ {
968 hi := highbits(dat[end])
969 if hi != batchHighBits {
970 batch := make([]uint32, end-start)
971 for i := 0; i < end-start; i++ {
972 batch[i] = lowbits(dat[start+i])
973 }
974 rb.getOrCreateContainer(batchHighBits).AddMany(batch)
975
976 batchHighBits = hi
977 start = end
978 }
979 }
980
981 batch := make([]uint32, len(dat)-start)
982 for i := 0; i < len(dat)-start; i++ {
983 batch[i] = lowbits(dat[start+i])
984 }
985 rb.getOrCreateContainer(batchHighBits).AddMany(batch)
986}
987
988// getOrCreateContainer gets the roaring.Bitmap for key hb,
989// or creates an *empty* roaring.Bitmap, inserts it to rb.highlowcontainer, and returns the new roaring.Bitmap.

Callers 5

BitmapOfFunction · 0.95
TestRoaringBitmapAddManyFunction · 0.95
TestBitMapValidationFunction · 0.95
Test64BitValuesFunction · 0.45

Calls 3

getOrCreateContainerMethod · 0.95
highbitsFunction · 0.70
lowbitsFunction · 0.70

Tested by 4

TestRoaringBitmapAddManyFunction · 0.76
TestBitMapValidationFunction · 0.76
Test64BitValuesFunction · 0.36