bits

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bits

type Bits struct {
	Value []byte
}

func NewBits

func NewBits(s string) *Bits

NewBits declare a Bits struct

func NewBitsFromBytes

func NewBitsFromBytes(b ...byte) *Bits

NewBitsFromBytes declare a Bits struct from bytes

func NewBitsFromString

func NewBitsFromString(s string, base int) *Bits

func (Bits) Bool

func (b Bits) Bool() bool

Bool return true if the Bits is not 0, otherwise false.

func (*Bits) Clr

func (b *Bits) Clr(pos int) Bits

Clr the bit value with 0

func (Bits) Get

func (b Bits) Get(pos int) *Bits

Get the bit value of the Bits

func (Bits) Mask

func (b Bits) Mask(l int) *Bits

Mask return the 0~l sub-bits

func (*Bits) Set

func (b *Bits) Set(pos int) Bits

Set the bit value with 1

func (*Bits) SetValue

func (b *Bits) SetValue(pos int, bb bool) Bits

SetValue the bit value with boolean

Jump to

Keyboard shortcuts

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