FromDense creates a bitmap from a slice of uint64s representing the bitmap as a dense bitmap. Useful to convert bitmaps from libraries like https://github.com/bits-and-blooms/bitset or https://github.com/kelindar/bitmap into roaring bitmaps fast and with convenience. This function will not create a
(bitmap []uint64, doCopy bool)
| 103 | // |
| 104 | // See also FromBitSet. |
| 105 | func FromDense(bitmap []uint64, doCopy bool) *Bitmap { |
| 106 | sz := (len(bitmap) + bitmapContainerSize - 1) / bitmapContainerSize // round up |
| 107 | rb := &Bitmap{ |
| 108 | highlowcontainer: roaringArray{ |
| 109 | containers: make([]container, 0, sz), |
| 110 | keys: make([]uint16, 0, sz), |
| 111 | needCopyOnWrite: make([]bool, 0, sz), |
| 112 | }, |
| 113 | } |
| 114 | rb.FromDense(bitmap, doCopy) |
| 115 | return rb |
| 116 | } |
| 117 | |
| 118 | // FromDense unmarshalls from a slice of uint64s representing the bitmap as a dense bitmap. |
| 119 | // Useful to convert bitmaps from libraries like https://github.com/bits-and-blooms/bitset or |
searching dependent graphs…