bitset

package module
v0.0.0-...-537b6b7 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 1 Imported by: 2

README

BitSet

A BitSet utility package written in Golang.

The BitSet is useful for managing a large number of bools.

See the test file for example usage.

Documentation

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 is used for storing lots of bits.

func NewBitSet

func NewBitSet(indicesToSetTrue ...int) *BitSet

func (*BitSet) And

func (bs *BitSet) And(other *BitSet) *BitSet

And performs a bitwise AND against the argument bitset (mutates the bitset!)

func (*BitSet) Clear

func (bs *BitSet) Clear()

Clear will clear all of the bits in the bitset

func (*BitSet) Clone

func (bs *BitSet) Clone() *BitSet

Clone creates a copy of the BitSet

func (*BitSet) ContainsAll

func (bs *BitSet) ContainsAll(other *BitSet) bool

ContainsAll returns true if this bitset contains all flags present in the other bitset

func (*BitSet) Empty

func (bs *BitSet) Empty() bool

Empty returns false if any bit is set in the BitSet

func (*BitSet) Equals

func (bs *BitSet) Equals(other *BitSet) bool

Equals tests if this bitset and the argument bitset are identical

func (*BitSet) Flip

func (bs *BitSet) Flip(idx int)

Flip inverts the bit at the given index in the bitset

func (*BitSet) Get

func (bs *BitSet) Get(idx int) bool

Get will return the bit value at the given index in the entire bitset.

func (*BitSet) GetAndClear

func (bs *BitSet) GetAndClear(idx uint64) bool

GetAndClear will return the bit value at the given index in the entire bitset, and clear it in one step

func (*BitSet) GetAndSet

func (bs *BitSet) GetAndSet(idx uint64) bool

GetAndSet will return the bit value at the given index in the entire bitset, and set it in one step

func (*BitSet) Intersects

func (bs *BitSet) Intersects(other *BitSet) bool

Intersects returns true if this bitset contains any of the bits from the other bitset

func (*BitSet) Invert

func (bs *BitSet) Invert() *BitSet

Invert all of the bits in the bitset (mutates the bitset!)

func (*BitSet) NotEmpty

func (bs *BitSet) NotEmpty() bool

NotEmpty returns true if any bit is set in the BitSet

func (*BitSet) Or

func (bs *BitSet) Or(other *BitSet) *BitSet

Or performs a bitwise OR against the argument bitset (mutates the bitset!)

func (*BitSet) Set

func (bs *BitSet) Set(idx int, b bool)

Set will set the bit value at the given index in the bitset

func (*BitSet) ToIntArray

func (bs *BitSet) ToIntArray() []uint64

func (*BitSet) Xor

func (bs *BitSet) Xor(other *BitSet) *BitSet

Xor performs a bitwise XOR against the argument bitset (mutates the bitset!)

Jump to

Keyboard shortcuts

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