bitset

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

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 a set of bits.

func NewBitSet

func NewBitSet(capacity uint) BitSet

NewBitSet returns a new BitSet with the given capacity.

func (BitSet) Capacity

func (s BitSet) Capacity() uint

Capacity returns the capacity of the BitSet.

func (BitSet) Count

func (s BitSet) Count() (count uint)

Count returns the number of bits set to 1.

func (*BitSet) Flip

func (s *BitSet) Flip(index uint)

Flip flips the bit at the given index.

func (*BitSet) FlipAll

func (s *BitSet) FlipAll()

FlipAll flips all bits.

func (BitSet) IsSet

func (s BitSet) IsSet(index uint) bool

IsSet returns whether the bit at the given index is set to 1.

func (*BitSet) Set

func (s *BitSet) Set(index uint)

Set sets the bit at the given index to 1.

func (*BitSet) SetAll

func (s *BitSet) SetAll()

SetAll sets all bits to 1.

func (*BitSet) Unset

func (s *BitSet) Unset(index uint)

Unset sets the bit at the given index to 0.

func (*BitSet) UnsetAll

func (s *BitSet) UnsetAll()

UnsetAll sets all bits to 0.

Jump to

Keyboard shortcuts

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