File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ func andSparseWithDenseBitArray(sba *sparseBitArray, other *bitArray) BitArray {
8383
8484 // Run through the sparse array and attempt comparisons wherever
8585 // possible against the dense bit array.
86- for selfIndex , selfValue := range ba .indices {
86+ for selfIndex , selfValue := range sba .indices {
8787
8888 if selfValue >= uint64 (len (other .blocks )) {
8989 // The dense bit array has been exhausted. This is the
@@ -98,6 +98,11 @@ func andSparseWithDenseBitArray(sba *sparseBitArray, other *bitArray) BitArray {
9898 }
9999 ba .blocks [selfIndex ] = ba .blocks [selfIndex ].and (
100100 other .blocks [selfValue ])
101+
102+ if ba .blocks [selfIndex ] == 0 {
103+ ba .blocks .deleteAtIndex (int64 (selfIndex ))
104+ ba .indices .deleteAtIndex (int64 (selfIndex ))
105+ }
101106 }
102107
103108 return ba
You can’t perform that action at this time.
0 commit comments