mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
rename conversion funcs to prepare for rle
also support rle in clone()
This commit is contained in:
parent
e80812cb0a
commit
98c8fd1ded
1 changed files with 9 additions and 4 deletions
|
|
@ -1086,7 +1086,7 @@ func (c *container) arrayAdd(v uint32) bool {
|
|||
|
||||
// Convert to a bitmap container if too many values are in an array container.
|
||||
if c.n >= ArrayMaxSize {
|
||||
c.convertToBitmap()
|
||||
c.arrayToBitmap()
|
||||
return c.bitmapAdd(v)
|
||||
}
|
||||
|
||||
|
|
@ -1223,7 +1223,7 @@ func (c *container) bitmapRemove(v uint32) bool {
|
|||
|
||||
// Convert to array if we go below the threshold.
|
||||
if c.n == ArrayMaxSize {
|
||||
c.convertToArray()
|
||||
c.bitmapToArray()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
@ -1297,7 +1297,7 @@ func (c *container) runMax() uint32 {
|
|||
}
|
||||
|
||||
// convertToArray converts the values in the bitmap to array values.
|
||||
func (c *container) convertToArray() {
|
||||
func (c *container) bitmapToArray() {
|
||||
c.array = make([]uint32, 0, c.n)
|
||||
for i, bitmap := range c.bitmap {
|
||||
for bitmap != 0 {
|
||||
|
|
@ -1311,7 +1311,7 @@ func (c *container) convertToArray() {
|
|||
}
|
||||
|
||||
// convertToBitmap converts the values in array to bitmap values.
|
||||
func (c *container) convertToBitmap() {
|
||||
func (c *container) arrayToBitmap() {
|
||||
c.bitmap = make([]uint64, bitmapN)
|
||||
for _, v := range c.array {
|
||||
c.bitmap[int(v)/64] |= (uint64(1) << uint(v%64))
|
||||
|
|
@ -1334,6 +1334,11 @@ func (c *container) clone() *container {
|
|||
copy(other.bitmap, c.bitmap)
|
||||
}
|
||||
|
||||
if c.runs != nil {
|
||||
other.runs = make([]interval16, len(c.runs))
|
||||
copy(other.runs, c.runs)
|
||||
}
|
||||
|
||||
return other
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue