bitset

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: MIT Imports: 0 Imported by: 7 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Bitset

Go port of std::bitset.

Currently, supports 4 variants:

  • Bitset8 (stores 8 bits on [0:7])
  • Bitset16 (stores 16 bits on [0:15])
  • Bitset32 (stores 32 bits on [0:31])
  • Bitset64 (stores 64 bits on [0:63])
Usage
var b Bitset
b.SetBit(7, true)
println(b.CheckBit(7)) // true

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitset

type Bitset = Bitset64

Bitset is an alias of Bitset64.

type Bitset8

type Bitset8 uint8

Bitset8 represents sets of 8 bits.

func (*Bitset8) CheckBit

func (b *Bitset8) CheckBit(pos int) bool

CheckBit checks bool value of bit on position pos [0:7].

func (*Bitset8) Reset

func (b *Bitset8) Reset()

Reset sets all bits to false.

func (*Bitset8) SetBit

func (b *Bitset8) SetBit(pos int, value bool)

SetBit sets bool value to bit on position pos [0:7].

type Bitset16

type Bitset16 uint16

Bitset16 represents sets of 16 bits.

func (*Bitset16) CheckBit

func (b *Bitset16) CheckBit(pos int) bool

CheckBit checks bool value of bit on position pos [0:15].

func (*Bitset16) Reset

func (b *Bitset16) Reset()

Reset sets all bits to false.

func (*Bitset16) SetBit

func (b *Bitset16) SetBit(pos int, value bool)

SetBit sets bool value to bit on position pos [0:15].

type Bitset32

type Bitset32 uint32

Bitset32 represents sets of 32 bits.

func (*Bitset32) CheckBit

func (b *Bitset32) CheckBit(pos int) bool

CheckBit checks bool value of bit on position pos [0:31].

func (*Bitset32) Reset

func (b *Bitset32) Reset()

Reset sets all bits to false.

func (*Bitset32) SetBit

func (b *Bitset32) SetBit(pos int, value bool)

SetBit sets bool value to bit on position pos [0:31].

type Bitset64

type Bitset64 uint64

Bitset64 represents sets of 64 bits.

func (*Bitset64) CheckBit

func (b *Bitset64) CheckBit(pos int) bool

CheckBit checks bool value of bit on position pos [0:63].

func (*Bitset64) Reset

func (b *Bitset64) Reset()

Reset sets all bits to false.

func (*Bitset64) SetBit

func (b *Bitset64) SetBit(pos int, value bool)

SetBit sets bool value to bit on position pos [0:63].

type Interface

type Interface interface {
	SetBit(int, bool)
	CheckBit(int) bool
	Reset()
}

Jump to

Keyboard shortcuts

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