bit_field

package
v0.0.0-...-35d8de9 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 6 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 struct {
	// contains filtered or unexported fields
}

BitField is a luci/gae-serializable bit field implementation. It should be nice and fast for non-AppEngine use as well.

You should construct a new one with bf.Make, rather than by direct construction.

func Make

func Make(size uint32) BitField

Make creates a new BitField.

func (BitField) All

func (bf BitField) All(val bool) bool

All returns true iff all of the bits are equal to `val`.

func (BitField) Clear

func (bf BitField) Clear(idx uint32)

Clear turns the given bit to false, regardless of its previous value. Will panic if idx >= Size().

func (BitField) CountSet

func (bf BitField) CountSet() (ret uint32)

CountSet returns the number of true bits.

func (*BitField) FromProperty

func (bf *BitField) FromProperty(p datastore.Property) error

FromProperty implements datastore.PropertyConverter

func (BitField) IsSet

func (bf BitField) IsSet(idx uint32) bool

IsSet returns the value of a given bit.

func (*BitField) MarshalBinary

func (bf *BitField) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaller

func (*BitField) Reset

func (bf *BitField) Reset()

Reset resets this BitField to the 'empty' (size-0) state.

func (BitField) Set

func (bf BitField) Set(idx uint32)

Set turns the given bit to true, regardless of its previous value. Will panic if idx >= Size().

func (BitField) Size

func (bf BitField) Size() uint32

Size returns the number of bits which this BitField can hold.

func (*BitField) ToProperty

func (bf *BitField) ToProperty() (datastore.Property, error)

ToProperty implements datastore.PropertyConverter

func (*BitField) UnmarshalBinary

func (bf *BitField) UnmarshalBinary(bs []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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