Add the integer x to the bitmap
(x uint64)
| 320 | |
| 321 | // Add the integer x to the bitmap |
| 322 | func (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) |
| 336 | func (rb *Bitmap) CheckedAdd(x uint64) bool { |