bitset

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const BitsPerWord = 64

Variables

This section is empty.

Functions

func BitWordsCount

func BitWordsCount(bitSize int) int

func ClearBit

func ClearBit(bitmap []uint64, i int)

set value of bit at index `i` to false

func FlipBit

func FlipBit(bitmap []uint64, i int)

toggles the values of bit at index `i`

func MustSetBit

func MustSetBit(bitmap []uint64, i int) []uint64

grow bitmap if index overflow

func OnesCount

func OnesCount(bitmap []uint64) int

func SetBit

func SetBit(bitmap []uint64, i int)

set value of bit at index `i` to true

func TestBit

func TestBit(bitmap []uint64, i int) bool

access value of the bit at index `i`

Types

type BitMap

type BitMap []uint64

func NewBitMap

func NewBitMap(bitSize int) BitMap

func (BitMap) Clear

func (bs BitMap) Clear(i int) bool

set value of bit at index `i` to false

func (BitMap) Count

func (bs BitMap) Count() int

returns the number of bits set to true

func (BitMap) Flip

func (bs BitMap) Flip(i int) bool

toggles the values of bit at index `i`

func (BitMap) FormattedString

func (bs BitMap) FormattedString(width int) string

按宽度对齐

func (BitMap) Reset

func (bs BitMap) Reset()

set all bits to false

func (BitMap) Set

func (bs BitMap) Set(i int) bool

set value of bit at index `i` to true

func (*BitMap) Size

func (bs *BitMap) Size() int

returns the number of bits that the bitset holds

func (BitMap) String

func (bs BitMap) String() string

func (BitMap) Test

func (bs BitMap) Test(i int) bool

access value of the bit at index `i`

Jump to

Keyboard shortcuts

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