summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/RoaringBitmap/roaring/roaring.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/RoaringBitmap/roaring/roaring.go')
-rw-r--r--vendor/github.com/RoaringBitmap/roaring/roaring.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/github.com/RoaringBitmap/roaring/roaring.go b/vendor/github.com/RoaringBitmap/roaring/roaring.go
index 15332e4956..53068e4d93 100644
--- a/vendor/github.com/RoaringBitmap/roaring/roaring.go
+++ b/vendor/github.com/RoaringBitmap/roaring/roaring.go
@@ -1552,3 +1552,27 @@ func (rb *Bitmap) Stats() Statistics {
}
return stats
}
+
+func (rb *Bitmap) checkValidity() bool {
+ for _, c := range rb.highlowcontainer.containers {
+
+ switch c.(type) {
+ case *arrayContainer:
+ if c.getCardinality() > arrayDefaultMaxSize {
+ fmt.Println("Array containers are limited to size ", arrayDefaultMaxSize)
+ return false
+ }
+ case *bitmapContainer:
+ if c.getCardinality() <= arrayDefaultMaxSize {
+ fmt.Println("Bitmaps would be more concise as an array!")
+ return false
+ }
+ case *runContainer16:
+ if c.getSizeInBytes() > minOfInt(bitmapContainerSizeInBytes(), arrayContainerSizeInBytes(c.getCardinality())) {
+ fmt.Println("Inefficient run container!")
+ return false
+ }
+ }
+ }
+ return true
+} \ No newline at end of file