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)
| 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) |
| 368 | func (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)) |
| 383 | func (rb *Bitmap) IsEmpty() bool { |