Length of bitset in From function
Closed this issue · 1 comments
arberiii commented
Take a look at this code
b1 := bitset.New(1)
b1.Set(0)
bb := b1.Bytes()
b2 := bitset.From(bb)
fmt.Println(b1.Len())
fmt.Println(b2.Len())
fmt.Println(b1.Equal(b2))
I get :
1
64
false
I understand that in From function the length is set to be 64 times the length but why is that so, and how can recreate the same bitset if wanted?
lemire commented
You appear to want to serialize the object. We offer several functions for this purpose such as MarshalBinary, MashalJSON and so forth. The Bytes function is not documented as s viable serialization approach.
Please try to follow the interface.