bitmap

package module
v0.0.0-...-3a8e5c9 Latest Latest
Warning

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

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

README

bitmap

A dynamic bitmap array that supports building a bitmap from programatically defined constant values OR build a list from a resource such as a text file for file directory. When the order is not known or may change passing in a map[string]int pointer will populate and can function as a helper lookup tool.

example use case


const (
	Read = 1 << iota
	Write
	Update
)

func main() {

   
	b := NewBitMap(nil, nil)
	b.Set(Write)
	b.Set(5)
	b.Set(66)
	fmt.Printf("%b %t %t\n", b, b.IsSet(Write), b.IsSet(63))
  	// &[100100 100] true false
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitMap

type BitMap []uint64

func NewBitMap

func NewBitMap(r io.Reader, bitmap *map[string]int) *BitMap

NewBitMap populates and returns a *BitMap based on the io.Reader reading order and populates bitmap *map[string]int when non-nil; expects an \n delimited simple reference list to be provided for the bitmap lookup reference

func (*BitMap) IsSet

func (b *BitMap) IsSet(n int) bool

IsSet index

func (*BitMap) Set

func (b *BitMap) Set(n int)

Set index; dynamic sizer

func (*BitMap) Unset

func (b *BitMap) Unset(n int)

Unset index

Jump to

Keyboard shortcuts

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