bitset

package
v0.0.0-...-6574182 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2015 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Byte is 8 bits
	Byte = 8
)

Variables

This section is empty.

Functions

func Size

func Size(n uint64) uint64

Size returns the number of bytes required for the Bitset to contain at least n values

Types

type Bitset

type Bitset []byte

Bitset is an object that makes working with large numbers of boolean values simple and memory efficient

func New

func New(n uint64) Bitset

New returns a new Bitset big enough to hold at least n values

func (Bitset) Flip

func (s Bitset) Flip(i uint64) bool

Flip toggles the bit at index i and returns the new value

func (Bitset) IsSet

func (s Bitset) IsSet(i uint64) bool

IsSet returns whether the bit at index i is set

func (Bitset) Len

func (s Bitset) Len() uint64

Len returns the size of the Bitset in bytes

func (Bitset) ListSet

func (s Bitset) ListSet() []uint64

ListSet returns a set of all enabled indexes

func (Bitset) ListUnset

func (s Bitset) ListUnset() []uint64

ListUnset returns a set of all unset indexes

func (Bitset) Max

func (s Bitset) Max() uint64

Max returns the highest value that can be set

func (Bitset) Set

func (s Bitset) Set(i uint64) Bitset

Set the bit at index i

func (Bitset) SetAll

func (s Bitset) SetAll() Bitset

SetAll enables all bits in the Bitset

func (Bitset) Unset

func (s Bitset) Unset(i uint64) Bitset

Unset the bit at index i

Jump to

Keyboard shortcuts

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