fix wrong comments, add new comments

This commit is contained in:
Tnze
2023-02-21 19:50:12 +08:00
parent c5dd27365e
commit 7d9ea21e65

View File

@ -25,7 +25,7 @@ type BitStorage struct {
valuesPerLong int valuesPerLong int
} }
// NewBitStorage create a new BitStorage. Return nil if bits == 0. // NewBitStorage create a new BitStorage.
// //
// The "bits" is the number of bits per value, which can be calculated by math/bits.Len() // The "bits" is the number of bits per value, which can be calculated by math/bits.Len()
// The "length" is the number of values. // The "length" is the number of values.
@ -195,6 +195,8 @@ func (b *BitStorage) WriteTo(w io.Writer) (int64, error) {
return n, nil return n, nil
} }
// Fix recalculate BitStorage internal values for given bits.
// Typically, you should call this method after ReadFrom is called, internal data is changed.
func (b *BitStorage) Fix(bits int) error { func (b *BitStorage) Fix(bits int) error {
if bits == 0 { if bits == 0 {
b.mask = 0 b.mask = 0