go-ewah: github.com/erizocosmico/go-ewah Index | Files

package ewah

import "github.com/erizocosmico/go-ewah"

Index

Package Files

bitmap.go

Variables

var ErrInvalidBitSet = errors.New("bitmap: attempted to set a bit before the last written bit")

ErrInvalidBitSet is returned when there is an attempt to set a bit before the last written bit.

type Bitmap Uses

type Bitmap struct {
    // contains filtered or unexported fields
}

Bitmap is an EWAH-encoded bitmap. See: https://github.com/lemire/javaewah

func FromBytes Uses

func FromBytes(b []byte, order binary.ByteOrder) (*Bitmap, error)

FromBytes creates a Bitmap from the given bytes.

func FromReader Uses

func FromReader(r io.Reader, order binary.ByteOrder) (*Bitmap, error)

FromReader creates a Bitmap from the given reader.

func New Uses

func New() *Bitmap

New creates a new empty bitmap.

func (*Bitmap) Bits Uses

func (b *Bitmap) Bits() uint32

Bits returns the number of uncompressed bits in the bitmap.

func (*Bitmap) Bytes Uses

func (b *Bitmap) Bytes() int64

Bytes returns the number of bytes taken by the compressed bitmap.

func (*Bitmap) Get Uses

func (b *Bitmap) Get(pos int64) bool

Get returns the bit at the given position, being true 1 and false 0.

func (*Bitmap) Reset Uses

func (b *Bitmap) Reset()

Reset clears the bitmap and sets everything to unused empty zeroes.

func (*Bitmap) Set Uses

func (b *Bitmap) Set(pos int64) error

Set sets to 1 the bit at the given position. Take into account that bits need to be set in ascending order. Setting the 4th bit will return an error if you already set the 5th bit, for example.

func (*Bitmap) Write Uses

func (b *Bitmap) Write(w io.Writer, order binary.ByteOrder) (n int64, err error)

Write will write the Bitmap to a writer with the following format: https://github.com/git/git/blob/master/Documentation/technical/bitmap-format.txt#L92

Package ewah imports 6 packages (graph). Updated 2019-03-22. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).