Documentation ¶
Index ¶
- func Serialize(w io.Writer, bm *Bitmap) (int, error)
- type Bitmap
- func (bm *Bitmap) AndNot(obm *Bitmap)
- func (bm *Bitmap) Append(obm *Bitmap)
- func (bm *Bitmap) Cap() int
- func (bm *Bitmap) Clone() *Bitmap
- func (bm *Bitmap) Count() int
- func (bm *Bitmap) Data() []uint64
- func (bm *Bitmap) Ensure(n int)
- func (bm *Bitmap) Get(n int) bool
- func (bm *Bitmap) Invert()
- func (bm *Bitmap) KeepFirstN(n int)
- func (bm *Bitmap) Or(obm *Bitmap)
- func (bm *Bitmap) Set(n int, val bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bitmap ¶
type Bitmap struct {
// contains filtered or unexported fields
}
Bitmap holds a series of boolean values, efficiently encoded as bits of uint64s
func DeserializeBitmapFromReader ¶
DeserializeBitmapFromReader is the inverse of Serialize
func NewBitmapFromBits ¶
NewBitmapFromBits leverages a pre-existing bitmap (usually from a file or a reader) and moves it into a new bitmap (does NOT copy)
func NewBitmapFromBools ¶
NewBitmapFromBools initialises a bitmap from a pre-existing bool slice
func (*Bitmap) Append ¶
Append adds data from an incoming bitmap to this bitmap (in place modification)
func (*Bitmap) Cap ¶
Cap returns the length of this bitmap (because the storage uints can have a higher capacity)
func (*Bitmap) Clone ¶
Clone returns a new bitmap with identical content (but a different backing data structure)
func (*Bitmap) Ensure ¶
Ensure makes sure we have at least n capacity in this bitmap (e.g. so that .Get works)
func (*Bitmap) KeepFirstN ¶
KeepFirstN leaves only the first n bits set, resets the rest to zeroes does not truncate the underlying storage - the cap is still the same - perhaps we should do this? once we hit the n == count condition, we can discard the rest and lower the cap? will require a fair bit of testing, but should be doable