bitmap

package
v0.0.0-...-ba811e8 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitmap

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

func New

func New(size int) *Bitmap

func (*Bitmap) Bit

func (b *Bitmap) Bit(i int) uint

Bit returns the value of the i'th bit of b. The bit index i must be >= 0.

func (*Bitmap) Bytes

func (b *Bitmap) Bytes() []byte

Bytes returns the absolute value of b as a big-endian byte slice.

func (*Bitmap) Range

func (b *Bitmap) Range(s, e int) *Bitmap

Range returns bits [s, e) as another bitmap.

func (*Bitmap) SetBit

func (b *Bitmap) SetBit(i int, v uint)

SetBit sets b's i'th bit to v (0 or 1). If b is not 0 or 1, SetBit will panic.

func (*Bitmap) SetBytes

func (b *Bitmap) SetBytes(buf []byte)

SetBytes interprets buf as the bytes of a big-endian unsigned integer, and sets b to that value.

func (*Bitmap) SetString

func (b *Bitmap) SetString(s string) bool

SetString sets b to the value of s, interpreted in the given base, and returns a boolean indicating success.

A prefix of “0b” or “0B” selects base 2, “0”, “0o” or “0O” selects base 8, and “0x” or “0X” selects base 16. Otherwise, the selected base is 10 and no prefix is accepted.

func (*Bitmap) SetUint64

func (b *Bitmap) SetUint64(x uint64)

SetUint64 sets b to x.

func (*Bitmap) Size

func (b *Bitmap) Size() int

func (*Bitmap) String

func (b *Bitmap) String(base int) string

String returns the string representation of b in the given base. Base must be between 2 and 62, inclusive.

func (*Bitmap) Uint64

func (b *Bitmap) Uint64() (uint64, bool)

Uint64 returns the uint64 representation of b. If b cannot be represented in a uint64, Uint64 will return (0, false).

Jump to

Keyboard shortcuts

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