-
Notifications
You must be signed in to change notification settings - Fork 241
Open
Description
When using roaring64.BSI, due to value type is *big.Int , bsi's bitCount is Variable length even if some negative value is set. Thus there is a bug, when bsi's min negative value's bitLen is less than max positive num, GetValue will get wrong error.
testcode
bsi := roaring64.NewDefaultBSI()
for i:=-100;i<100;i++ {
bsi.SetValue(uint64(i+100),int64(i))
}
fmt.Println(bsi.GetValue(0))
result is -100, true
bsi := roaring64.NewDefaultBSI()
for i:=-100;i<1000;i++ {
bsi.SetValue(uint64(i+100),int64(i))
}
fmt.Println(bsi.GetValue(0))
result is 156, true
So if code uses len(b.bA) as sign bit may not work
Metadata
Metadata
Assignees
Labels
No labels