boolmap

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: ISC Imports: 0 Imported by: 1

README

boolmap

-- import "vimagination.zapto.org/boolmap"

Package boolmap creates a map of bools using bytes for efficiency (needs benchmarking for memory)

Usage

type CrumbMap
type CrumbMap map[uint64]byte

CrumbMap is a map of Crumbs (2-bits, values 0, 1, 2, 3)

func NewCrumbMap
func NewCrumbMap() CrumbMap

NewCrumbMap returns a new, initialised, CrumbMap

func (CrumbMap) Get
func (c CrumbMap) Get(p uint64) byte

Get returns a crumb from the given position

func (CrumbMap) Set
func (c CrumbMap) Set(p uint64, d byte)

Set sets the crumb at the given position

type CrumbSlice
type CrumbSlice []byte

CrumbSlice is a slice of bytes, representing crumbs (2-bits)

func NewCrumbSlice
func NewCrumbSlice() *CrumbSlice

NewCrumbSlice returns a new, initialised, CrumbSlice

func NewCrumbSliceSize
func NewCrumbSliceSize(size uint) *CrumbSlice

NewCrumbSliceSize returns a new Crumbslice, initialised to the given size

func (CrumbSlice) Get
func (c CrumbSlice) Get(p uint) byte

Get returns a crumb from the given position

func (*CrumbSlice) Set
func (c *CrumbSlice) Set(p uint, d byte)

Set sets the crumb at the given position

type Map
type Map map[uint64]byte

Map is the default boolmap

func NewMap
func NewMap() Map

NewMap returns a new, initialised Map

func (Map) Get
func (m Map) Get(p uint64) byte

Get returns a bool, represented by a byte, for the specified position

func (Map) GetBool
func (m Map) GetBool(p uint64) bool

GetBool returns a bool for the specified position

func (Map) Set
func (m Map) Set(p uint64, d byte)

Set sets a bool, represented by a byte, at the specified position

func (Map) SetBool
func (m Map) SetBool(p uint64, d bool)

SetBool sets a bool at the specified position

type NibbleMap
type NibbleMap map[uint64]byte

NibbleMap is a map of Nibbles (4-bits, values 0-15)

func NewNibbleMap
func NewNibbleMap() NibbleMap

NewNibbleMap return a new, initialised, NibbleMap

func (NibbleMap) Get
func (n NibbleMap) Get(p uint64) byte

Get returns a crumb from the given position

func (NibbleMap) Set
func (n NibbleMap) Set(p uint64, d byte)

Set sets the crumb at the given position

type NibbleSlice
type NibbleSlice []byte

NibbleSlice is a slice of bytes representing nibbles (4-bits)

func NewNibbleSlice
func NewNibbleSlice() NibbleSlice

NewNibbleSlice returns a new, initialised, CrumbSlice

func NewNibbleSliceSize
func NewNibbleSliceSize(size uint) NibbleSlice

NewNibbleSliceSize returns a new NibbleSlice, initialised to the given size

func (NibbleSlice) Get
func (n NibbleSlice) Get(p uint) byte

Get returns a crumb from the given position

func (*NibbleSlice) Set
func (n *NibbleSlice) Set(p uint, d byte)

Set sets the crumb at the given position

type Slice
type Slice []byte

Slice is a slice of bytes representing bools

func NewSlice
func NewSlice() *Slice

NewSlice returnns a new, initialised Slice

func NewSliceSize
func NewSliceSize(size uint) *Slice

NewSliceSize returns a new Slice, intitialised to the size given

func (Slice) Get
func (s Slice) Get(p uint) byte

Get returns a byte, representing a bool, at the specified position

func (Slice) GetBool
func (s Slice) GetBool(p uint) bool

GetBool returns a bool for the specified position

func (*Slice) Set
func (s *Slice) Set(p uint, d byte)

Set sets a bool, given as a byte, at the specified position

func (*Slice) SetBool
func (s *Slice) SetBool(p uint, d bool)

SetBool sets a bool at the specified position

Documentation

Overview

Package boolmap creates a map of bools using bytes for efficiency (needs benchmarking for memory)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CrumbMap

type CrumbMap map[uint64]byte

CrumbMap is a map of Crumbs (2-bits, values 0, 1, 2, 3)

func NewCrumbMap

func NewCrumbMap() CrumbMap

NewCrumbMap returns a new, initialised, CrumbMap

func (CrumbMap) Get

func (c CrumbMap) Get(p uint64) byte

Get returns a crumb from the given position

func (CrumbMap) Set

func (c CrumbMap) Set(p uint64, d byte)

Set sets the crumb at the given position

type CrumbSlice

type CrumbSlice []byte

CrumbSlice is a slice of bytes, representing crumbs (2-bits)

func NewCrumbSlice

func NewCrumbSlice() *CrumbSlice

NewCrumbSlice returns a new, initialised, CrumbSlice

func NewCrumbSliceSize

func NewCrumbSliceSize(size uint) *CrumbSlice

NewCrumbSliceSize returns a new Crumbslice, initialised to the given size

func (CrumbSlice) Get

func (c CrumbSlice) Get(p uint) byte

Get returns a crumb from the given position

func (*CrumbSlice) Set

func (c *CrumbSlice) Set(p uint, d byte)

Set sets the crumb at the given position

type Map

type Map map[uint64]byte

Map is the default boolmap

func NewMap

func NewMap() Map

NewMap returns a new, initialised Map

func (Map) Get

func (m Map) Get(p uint64) byte

Get returns a bool, represented by a byte, for the specified position

func (Map) GetBool

func (m Map) GetBool(p uint64) bool

GetBool returns a bool for the specified position

func (Map) Set

func (m Map) Set(p uint64, d byte)

Set sets a bool, represented by a byte, at the specified position

func (Map) SetBool

func (m Map) SetBool(p uint64, d bool)

SetBool sets a bool at the specified position

type NibbleMap

type NibbleMap map[uint64]byte

NibbleMap is a map of Nibbles (4-bits, values 0-15)

func NewNibbleMap

func NewNibbleMap() NibbleMap

NewNibbleMap return a new, initialised, NibbleMap

func (NibbleMap) Get

func (n NibbleMap) Get(p uint64) byte

Get returns a crumb from the given position

func (NibbleMap) Set

func (n NibbleMap) Set(p uint64, d byte)

Set sets the crumb at the given position

type NibbleSlice

type NibbleSlice []byte

NibbleSlice is a slice of bytes representing nibbles (4-bits)

func NewNibbleSlice

func NewNibbleSlice() NibbleSlice

NewNibbleSlice returns a new, initialised, CrumbSlice

func NewNibbleSliceSize

func NewNibbleSliceSize(size uint) NibbleSlice

NewNibbleSliceSize returns a new NibbleSlice, initialised to the given size

func (NibbleSlice) Get

func (n NibbleSlice) Get(p uint) byte

Get returns a crumb from the given position

func (*NibbleSlice) Set

func (n *NibbleSlice) Set(p uint, d byte)

Set sets the crumb at the given position

type Slice

type Slice []byte

Slice is a slice of bytes representing bools

func NewSlice

func NewSlice() *Slice

NewSlice returnns a new, initialised Slice

func NewSliceSize

func NewSliceSize(size uint) *Slice

NewSliceSize returns a new Slice, intitialised to the size given

func (Slice) Get

func (s Slice) Get(p uint) byte

Get returns a byte, representing a bool, at the specified position

func (Slice) GetBool

func (s Slice) GetBool(p uint) bool

GetBool returns a bool for the specified position

func (*Slice) Set

func (s *Slice) Set(p uint, d byte)

Set sets a bool, given as a byte, at the specified position

func (*Slice) SetBool

func (s *Slice) SetBool(p uint, d bool)

SetBool sets a bool at the specified position

Jump to

Keyboard shortcuts

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