RoaringBitmap / roaring

Roaring bitmaps in Go (golang), used by InfluxDB, Bleve, DataDog
http://roaringbitmap.org/
Apache License 2.0
2.52k stars 230 forks source link

The p return value from Bitmap.FromUnsafeBytes is incorrect #444

Open anacrolix opened 1 month ago

anacrolix commented 1 month ago

The p return value from Bitmap.FromUnsafeBytes is incorrect and untested.

I experimented with using it to read consecutive packed bitmaps for the BSI implementation but it resulted in different p values than ReadFrom. I took a quick look at the tests and it wasn't checked in the unit tests when the feature was added.

@damnever

lemire commented 1 month ago

@anacrolix

The p return value from Bitmap.FromUnsafeBytes is incorrect

Please provide evidence. A simple example would suffice.

I strongly discourage such vague statements.

untested

I have added a test. Note that the function is made of two lines of code.

    stream := internal.NewByteBuffer(data)
    return rb.ReadFrom(stream)