bitfield

package
v0.97.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package bitfield provides a simple and efficient arbitrary size bit field implementation. It doesn't attempt to cover everything that could be done with bit fields, providing only things used by neo-go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field []uint64

Field is a bit field represented as a slice of uint64 values.

func New

func New(n int) Field

New creates a new bit field of specified length. Actual field length can be rounded to the next multiple of 64, so it's a responsibility of the user to deal with that.

func (Field) And

func (f Field) And(m Field)

And implements logical AND between f's and m's bits saving the result into f.

func (Field) Copy

func (f Field) Copy() Field

Copy makes a copy of current Field.

func (Field) Equals

func (f Field) Equals(o Field) bool

Equals compares two Fields and returns true if they're equal.

func (Field) IsSet

func (f Field) IsSet(i int) bool

IsSet returns true if the bit with specified offset is set.

func (Field) IsSubset

func (f Field) IsSubset(o Field) bool

IsSubset returns true when f is a subset of o (only has bits set that are set in o).

func (Field) Set

func (f Field) Set(i int)

Set sets one bit at specified offset. No bounds checking is done.

Jump to

Keyboard shortcuts

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