File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -421,18 +421,27 @@ func FromBitSet(bitset *bitset.BitSet) *Bitmap {
421421// ToArray creates a new slice containing all of the integers stored in the Bitmap in sorted order
422422func (rb * Bitmap ) ToArray () []uint32 {
423423 array := make ([]uint32 , rb .GetCardinality ())
424+ ar := rb .toArray (& array )
425+ return * ar
426+ }
427+
428+ func (rb * Bitmap ) toArray (array * []uint32 ) * []uint32 {
424429 pos := 0
425430 pos2 := 0
426431
427432 for pos < rb .highlowcontainer .size () {
428433 hs := uint32 (rb .highlowcontainer .getKeyAtIndex (pos )) << 16
429434 c := rb .highlowcontainer .getContainerAtIndex (pos )
430435 pos ++
431- pos2 = c .fillLeastSignificant16bits (array , pos2 , hs )
436+ pos2 = c .fillLeastSignificant16bits (* array , pos2 , hs )
432437 }
433438 return array
434439}
435440
441+ func (rb * Bitmap ) ToExistingArray (array * []uint32 ) * []uint32 {
442+ return rb .toArray (array )
443+ }
444+
436445// GetSizeInBytes estimates the memory usage of the Bitmap. Note that this
437446// might differ slightly from the amount of bytes required for persistent storage
438447func (rb * Bitmap ) GetSizeInBytes () uint64 {
You can’t perform that action at this time.
0 commit comments