We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6e38489 commit 72267ffCopy full SHA for 72267ff
1 file changed
roaring64/bsi64.go
@@ -990,6 +990,20 @@ func (b *BSI) ClearValues(foundSet *Bitmap) {
990
wg.Wait()
991
}
992
993
+// Retains only values found in retain. Returns how many values were not retained.
994
+func (b *BSI) Retain(retain *Bitmap) (dropped uint64) {
995
+ preCard := b.eBM.GetCardinality()
996
+ b.eBM.And(retain)
997
+ dropped = preCard - b.eBM.GetCardinality()
998
+ if dropped == 0 {
999
+ return
1000
+ }
1001
+ for i := range b.bA {
1002
+ b.bA[i].And(retain)
1003
1004
1005
+}
1006
+
1007
// NewBSIRetainSet - Construct a new BSI from a clone of existing BSI, retain only values contained in foundSet
1008
func (b *BSI) NewBSIRetainSet(foundSet *Bitmap) *BSI {
1009
0 commit comments