DenseSize returns the size of the bitmap when stored as a dense bitmap.
()
| 62 | |
| 63 | // DenseSize returns the size of the bitmap when stored as a dense bitmap. |
| 64 | func (rb *Bitmap) DenseSize() uint64 { |
| 65 | if rb.highlowcontainer.size() == 0 { |
| 66 | return 0 |
| 67 | } |
| 68 | |
| 69 | maximum := 1 + uint64(rb.Maximum()) |
| 70 | if maximum > (capacity - wordSize + 1) { |
| 71 | return capacity >> log2WordSize |
| 72 | } |
| 73 | |
| 74 | return (maximum + (wordSize - 1)) >> log2WordSize |
| 75 | } |
| 76 | |
| 77 | // ToDense returns a slice of uint64s representing the bitmap as a dense bitmap. |
| 78 | // Useful to convert a roaring bitmap to a format that can be used by other libraries |