MCPcopy Create free account
hub / github.com/RoaringBitmap/roaring / FromDense

Function FromDense

roaring.go:105–116  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

103//
104// See also FromBitSet.
105func 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

Callers 4

FromBitSetFunction · 0.85
TestFromDenseFunction · 0.85
BenchmarkFromDenseFunction · 0.85
BenchmarkAndNotFunction · 0.85

Calls 1

FromDenseMethod · 0.95

Tested by 3

TestFromDenseFunction · 0.68
BenchmarkFromDenseFunction · 0.68
BenchmarkAndNotFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…