bitset

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FixedBitSet

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

func NewFixed

func NewFixed(maxBits int) *FixedBitSet

Non-resizable bitset with basic operations.

func (*FixedBitSet) Clear

func (bs *FixedBitSet) Clear(bit int)

Write zero at the given bit position.

func (*FixedBitSet) CountOnes

func (bs *FixedBitSet) CountOnes() int

Return total number of ones in the bitset.

func (*FixedBitSet) CountZeros

func (bs *FixedBitSet) CountZeros() int

Return total number of zeros in the bitset.

func (*FixedBitSet) Get

func (bs *FixedBitSet) Get(bit int) bool

Determine if given bit position was set.

func (*FixedBitSet) Ones

func (bs *FixedBitSet) Ones() []int

Return positions of all previously set bits.

func (*FixedBitSet) Reset

func (bs *FixedBitSet) Reset()

Clear entire bitset.

func (*FixedBitSet) Set

func (bs *FixedBitSet) Set(bit int)

Write one at the given bit position.

func (*FixedBitSet) Size

func (bs *FixedBitSet) Size() int

Return size of underlying bytearray.

func (*FixedBitSet) Zeros

func (bs *FixedBitSet) Zeros() []int

Return positions of all zero-bits in the bitset.

type FixedThreadSafeBitSet

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

func NewFixedThreadSafe

func NewFixedThreadSafe(maxBits int) *FixedThreadSafeBitSet

Thread-safe wrapper around fixed-size bitset.

func (*FixedThreadSafeBitSet) Clear

func (bs *FixedThreadSafeBitSet) Clear(bit int)

func (*FixedThreadSafeBitSet) CountOnes

func (bs *FixedThreadSafeBitSet) CountOnes() int

func (*FixedThreadSafeBitSet) CountZeros

func (bs *FixedThreadSafeBitSet) CountZeros() int

func (*FixedThreadSafeBitSet) Get

func (bs *FixedThreadSafeBitSet) Get(bit int) bool

func (*FixedThreadSafeBitSet) Ones

func (bs *FixedThreadSafeBitSet) Ones() []int

func (*FixedThreadSafeBitSet) Reset

func (bs *FixedThreadSafeBitSet) Reset()

func (*FixedThreadSafeBitSet) Set

func (bs *FixedThreadSafeBitSet) Set(bit int)

func (*FixedThreadSafeBitSet) Zeros

func (bs *FixedThreadSafeBitSet) Zeros() []int

Jump to

Keyboard shortcuts

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