MCPcopy
hub / github.com/RoaringBitmap/roaring / ToArray

Method ToArray

roaring64/roaring64.go:217–230  ·  view source on GitHub ↗

ToArray creates a new slice containing all of the integers stored in the Bitmap in sorted order

()

Source from the content-addressed store, hash-verified

215
216// ToArray creates a new slice containing all of the integers stored in the Bitmap in sorted order
217func (rb *Bitmap) ToArray() []uint64 {
218 array := make([]uint64, rb.GetCardinality())
219 pos := 0
220 pos2 := uint64(0)
221
222 for pos < rb.highlowcontainer.size() {
223 hs := uint64(rb.highlowcontainer.getKeyAtIndex(pos)) << 32
224 c := rb.highlowcontainer.getContainerAtIndex(pos)
225 pos++
226 c.ManyIterator().NextMany64(hs, array[pos2:])
227 pos2 += c.GetCardinality()
228 }
229 return array
230}
231
232// GetSizeInBytes estimates the memory usage of the Bitmap. Note that this
233// might differ slightly from the amount of bytes required for persistent storage

Callers 3

TestBitmapCOWFunction · 0.95
TestBitmapFunction · 0.95
TestIssue330_64bitsFunction · 0.45

Calls 6

GetCardinalityMethod · 0.95
NextMany64Method · 0.65
sizeMethod · 0.45
getKeyAtIndexMethod · 0.45
getContainerAtIndexMethod · 0.45
ManyIteratorMethod · 0.45

Tested by 3

TestBitmapCOWFunction · 0.76
TestBitmapFunction · 0.76
TestIssue330_64bitsFunction · 0.36