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

Method Add

roaring64/roaring64.go:322–333  ·  view source on GitHub ↗

Add the integer x to the bitmap

(x uint64)

Source from the content-addressed store, hash-verified

320
321// Add the integer x to the bitmap
322func (rb *Bitmap) Add(x uint64) {
323 hb := highbits(x)
324 ra := &rb.highlowcontainer
325 i := ra.getIndex(hb)
326 if i >= 0 {
327 ra.getWritableContainerAtIndex(i).Add(lowbits(x))
328 } else {
329 newBitmap := roaring.NewBitmap()
330 newBitmap.Add(lowbits(x))
331 rb.highlowcontainer.insertNewKeyValueAt(-i-1, hb, newBitmap)
332 }
333}
334
335// CheckedAdd adds the integer x to the bitmap and return true if it was added (false if the integer was already present)
336func (rb *Bitmap) CheckedAdd(x uint64) bool {

Callers 15

CheckedAddMethod · 0.95
AddIntMethod · 0.95
TestIssue386Function · 0.95
TestCloneOfCOWFunction · 0.95
TestCloneOfCOWRangeFunction · 0.95
TestStringerCOWFunction · 0.95
TestFastCardCOWFunction · 0.95
TestIntersects1COWFunction · 0.95
TestRangePanicCOWFunction · 0.95
TestRangeRemovalCOWFunction · 0.95
TestBitmapRankCOWFunction · 0.95
TestBitmapSelectCOWFunction · 0.95

Calls 5

highbitsFunction · 0.70
lowbitsFunction · 0.70
getIndexMethod · 0.45
insertNewKeyValueAtMethod · 0.45

Tested by 15

TestIssue386Function · 0.76
TestCloneOfCOWFunction · 0.76
TestCloneOfCOWRangeFunction · 0.76
TestStringerCOWFunction · 0.76
TestFastCardCOWFunction · 0.76
TestIntersects1COWFunction · 0.76
TestRangePanicCOWFunction · 0.76
TestRangeRemovalCOWFunction · 0.76
TestBitmapRankCOWFunction · 0.76
TestBitmapSelectCOWFunction · 0.76
TestBitmapExtraCOWFunction · 0.76
TestBitmapCOWFunction · 0.76