bitset

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package bitset provides a fast implementation of Bitsets also called Bitarray, Bitvector...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitset

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

Bitset represents a bitset of fixed length

func New

func New(l int) Bitset

New creates a new bitset instance with length l.

func (*Bitset) BitLength

func (b *Bitset) BitLength() int

BitLength returns length in bits.

func (*Bitset) Clear

func (b *Bitset) Clear(pos int) error

Clear will clear the bit at pos.

func (*Bitset) Count

func (b *Bitset) Count() int

Count returns the number of set bits

func (*Bitset) IsSet

func (b *Bitset) IsSet(pos int) bool

IsSet checks if bit at pos is set.

func (*Bitset) Set

func (b *Bitset) Set(pos int) error

Set will set a bit at pos.

func (*Bitset) SetBits

func (b *Bitset) SetBits() []int

SetBits returns a list of indices of bits that are set.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL