bitfield

package
v0.0.0-...-98fa19b Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitField

type BitField []byte

func New

func New(n int) BitField

New returns a new BitField of at least n bits, all 0s

func NewFromUint32

func NewFromUint32(n uint32) BitField

NewFromUint32 returns a new BitField of 4 bytes, with n initial value

func NewFromUint64

func NewFromUint64(n uint64) BitField

NewFromUint64 returns a new BitField of 8 bytes, with n initial value

func (BitField) ANDMask

func (b BitField) ANDMask(m BitField)

ANDMask performs an AND operation between b and m, storing result in b. If b is smaller than m, the extra bits of m are ignored (b isn't enlarged).

func (BitField) Bytes

func (b BitField) Bytes() []byte

func (BitField) Clear

func (b BitField) Clear(i uint32)

Clear sets bit i to 0

func (BitField) ClearAll

func (b BitField) ClearAll()

ClearAll sets all BitField values to 0

func (BitField) Flip

func (b BitField) Flip(i uint32)

Flip toggles the value of bit i

func (BitField) FlipAll

func (b BitField) FlipAll()

FlipAll flips all the BitField bits (1's compliment)

func (BitField) GetX

func (b BitField) GetX(index int) BitField

func (BitField) ORMask

func (b BitField) ORMask(m BitField)

ORMask performs an OR operation between b and m, storing result in b. If b is smaller than m, the extra bits of m are ignored (b isn't enlarged).

func (BitField) Set

func (b BitField) Set(i uint32)

Set sets bit i to 1

func (BitField) SetAll

func (b BitField) SetAll()

SetAll sets all BitField bits to 1

func (BitField) SetX

func (b BitField) SetX(index int, v int) BitField

https://github.com/prysmaticlabs/go-bitfield

struct {
    USHORT Mode0 : 1;
    USHORT Mode1 : 1;
    USHORT Mode2 : 1;
    USHORT Reserved1 : 5;
    USHORT Mode0Sel : 1;
    USHORT Mode1Sel : 1;
    USHORT Mode2Sel : 1;
    USHORT Reserved2 : 5;
} wMultiWordDMA;

func (BitField) Size

func (b BitField) Size() int

Size returns BitField size in bytes (not bits)

func (BitField) Test

func (b BitField) Test(i uint32) bool

Test returns true/false on bit i value

func (BitField) ToUint32

func (b BitField) ToUint32() uint32

ToUint32 returns the lowest 4 bytes as an uint32 NO BOUNDS CHECKING, ENSURE BitField is at least 4 bytes long

func (BitField) ToUint32Safe

func (b BitField) ToUint32Safe() uint32

ToUint32Safe returns the lowest 4 bytes as an uint32

func (BitField) ToUint64

func (b BitField) ToUint64() uint64

ToUint64 returns the lowest 8 bytes as an uint64 NO BOUNDS CHECKING, ENSURE BitField is at least 8 bytes long

func (BitField) ToUint64Safe

func (b BitField) ToUint64Safe() uint64

ToUint64Safe returns the lowest 8 bytes as an uint64

func (BitField) XORMask

func (b BitField) XORMask(m BitField)

XORMask performs an XOR operation between b and m, storing result in b. If b is smaller than m, the extra bits of m are ignored (b isn't enlarged).

Jump to

Keyboard shortcuts

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