bits-and-blooms/bitset

Binary encoding is not proper big-endian byte array even if `binaryOrder = BigEndian`

Closed this issue · 1 comments

bitset/bitset.go

Lines 933 to 939 in 7e78d86

nWords := b.wordCount()
for i := range b.set[:nWords] {
binaryOrder.PutUint64(buf, b.set[i])
if nn, err := stream.Write(buf); err != nil {
return int64(i*int(wordBytes) + nn + n), err
}
}

WriteTo first writes the least significant word, so even if the individual words are in big-endian format entire bitset is not properly encoded as a big-endian byte array.

lemire commented

If you have trouble serializing and deserializing a bitset, please provide a complete reproducible test case.

As written, this issue fails to identify a reproducible bug.

Closing.