@@ -318,7 +318,7 @@ func (b *BSI) CompareBigValue(parallelism int, op Operation, valueOrStart, end *
318318 if valueOrStart == nil {
319319 valueOrStart = b .MinMaxBig (parallelism , MIN , & b .eBM )
320320 }
321- if end == nil {
321+ if end == nil && op == RANGE {
322322 end = b .MinMaxBig (parallelism , MAX , & b .eBM )
323323 }
324324
@@ -386,7 +386,10 @@ func compareValue(e *task, batch []uint64, resultsChan chan *Bitmap, wg *sync.Wa
386386 }
387387
388388 startIsNegative := e .valueOrStart .Sign () == - 1
389- endIsNegative := e .end .Sign () == - 1
389+ endIsNegative := true
390+ if e .end != nil {
391+ endIsNegative = e .end .Sign () == - 1
392+ }
390393
391394 for i := 0 ; i < len (batch ); i ++ {
392395 cID := batch [i ]
@@ -399,7 +402,7 @@ func compareValue(e *task, batch []uint64, resultsChan chan *Bitmap, wg *sync.Wa
399402 if isNegative != startIsNegative {
400403 compStartValue = twosComplement (e .valueOrStart , e .bsi .BitCount ()+ 1 )
401404 }
402- if isNegative != endIsNegative {
405+ if isNegative != endIsNegative && e . end != nil {
403406 compEndValue = twosComplement (e .end , e .bsi .BitCount ()+ 1 )
404407 }
405408
@@ -735,12 +738,12 @@ func (b *BSI) ParOr(parallelism int, bsis ...*BSI) {
735738 bits := len (b .bA )
736739 for i := 0 ; i < len (bsis ); i ++ {
737740 if len (bsis [i ].bA ) > bits {
738- bits = bsis [i ].BitCount ( )
741+ bits = len ( bsis [i ].bA )
739742 }
740743 }
741744
742745 // Make sure we have enough bit slices
743- for bits > b . BitCount ( ) {
746+ for bits > len ( b . bA ) {
744747 bm := Bitmap {}
745748 bm .RunOptimize ()
746749 b .bA = append (b .bA , bm )
0 commit comments