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

Method CheckedRemove

roaring64/roaring64.go:368–380  ·  view source on GitHub ↗

CheckedRemove removes the integer x from the bitmap and return true if the integer was effectively remove (and false if the integer was not present)

(x uint64)

Source from the content-addressed store, hash-verified

366
367// CheckedRemove removes the integer x from the bitmap and return true if the integer was effectively remove (and false if the integer was not present)
368func (rb *Bitmap) CheckedRemove(x uint64) bool {
369 hb := highbits(x)
370 i := rb.highlowcontainer.getIndex(hb)
371 if i >= 0 {
372 c := rb.highlowcontainer.getWritableContainerAtIndex(i)
373 removed := c.CheckedRemove(lowbits(x))
374 if removed && c.IsEmpty() {
375 rb.highlowcontainer.removeAtIndex(i)
376 }
377 return removed
378 }
379 return false
380}
381
382// IsEmpty returns true if the Bitmap is empty (it is faster than doing (GetCardinality() == 0))
383func (rb *Bitmap) IsEmpty() bool {

Callers 1

TestAddCheckedRemove64Function · 0.45

Calls 6

highbitsFunction · 0.70
lowbitsFunction · 0.70
getIndexMethod · 0.45
IsEmptyMethod · 0.45
removeAtIndexMethod · 0.45

Tested by 1

TestAddCheckedRemove64Function · 0.36