elib

package module
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: GPL-2.0, GPL-2.0-or-later Imports: 18 Imported by: 13

README

Eliot's library


© 2015-2018 Platina Systems, Inc. All rights reserved. Use of this source code is governed by this BSD-style LICENSE.

Documentation

Overview

Package elib is a collection of data structures: bitmaps, pools, heaps, fifos.

Index

Constants

View Source
const (
	Log2WordBits = 3 + (_m>>8&1 + _m>>16&1 + _m>>32&1)
	WordBits     = 1 << Log2WordBits

	Log2IntBits = 3 + (_n>>8&1 + _n>>16&1 + _n>>32&1)
	IntBits     = 1 << Log2IntBits
)
View Source
const CapNil = ^Cap(0)
View Source
const Debug = false
View Source
const License = `` /* 15871-byte string literal not displayed */
View Source
const (
	MaxNSub = 32
)
View Source
const Version = "v1.3.2"

Version format :: v<MAJOR>.<MINOR>.<PATCH>[-rc<CANDIDATE>]

Variables

View Source
var Bitmaps = &BitmapPool{}
View Source
var ErrHeapOverflow = errors.New("heap overflow")
View Source
var ErrPoolTooLarge = errors.New("pool: too large")

ErrTooLarge is passed to panic if pool overflows maxLen

View Source
var Logger = logger(nolog{})

Functions

func DecodeAddress

func DecodeAddress(x interface{}, address uint) (path []string, t reflect.Type)

func FibHeapTest

func FibHeapTest()

func FlagStringer

func FlagStringer(n []string, x Word) string

func FlagStringerWithFormat

func FlagStringerWithFormat(n []string, x Word, unknownFormat string) (s string)

func FuncName

func FuncName() (n string)

Name of current function as string.

func HashTest

func HashTest()

func HeapTest

func HeapTest()

func IsPow2

func IsPow2(x Word) bool

isPow2 true for x a power of 2

func MaxLog2

func MaxLog2(x Word) uint

func MinLog2

func MinLog2(x Word) uint

func MmapSlice

func MmapSlice(addr, length, prot, flags, fd, offset uintptr) (a uintptr, b []byte, err error)

func MmapSliceAligned

func MmapSliceAligned(log2_size, log2_align uint, flags, prot uintptr) (a uintptr, b []byte, err error)

func Munmap

func Munmap(b []byte) (err error)

func NLeadingZeros

func NLeadingZeros(x Word) uint

func NSetBits

func NSetBits(y Word) uint

func NextResizeCap

func NextResizeCap(x uint) uint

NextResizeCap gives next larger resizeable array capacity.

func PointerAdd

func PointerAdd(p unsafe.Pointer, i uintptr) unsafe.Pointer

func PointerPoison

func PointerPoison(p unsafe.Pointer, n uintptr)

func SparseTest

func SparseTest()

func Stringer

func Stringer(n []string, i int) string

func StringerHex

func StringerHex(n []string, i int) string

func StringerWithFormat

func StringerWithFormat(n []string, i int, unknownFormat string) string

func Tabulate

func Tabulate(x interface{}) (tab *table)

func TabulateWrite

func TabulateWrite(w io.Writer, x interface{})

func UnalignedUint16

func UnalignedUint16(p unsafe.Pointer, i uintptr) uint16

func UnalignedUint32

func UnalignedUint32(p unsafe.Pointer, i uintptr) uint32

func UnalignedUint64

func UnalignedUint64(p unsafe.Pointer, i uintptr) uint64

func WithDefaultNamespace

func WithDefaultNamespace(f func() (err error)) (err error)

Performs given callback in default namespace (e.g. without setns).

func WithNamespace

func WithNamespace(new_ns_fd, old_ns_fd, namespace_type int, f func() (err error)) (err error, first_setns_errno syscall.Errno)

WithNamespace performs given function in given namespace. {new,old}_ns_fd are open file descriptors to namespace "special" files.

Types

type BitCompressUint64

type BitCompressUint64 struct {
	// contains filtered or unexported fields
}

func (*BitCompressUint64) Compress

func (s *BitCompressUint64) Compress(x uint64) (r uint64)

func (*BitCompressUint64) Mask

func (s *BitCompressUint64) Mask() uint64

func (*BitCompressUint64) SetMask

func (s *BitCompressUint64) SetMask(mask uint64)

type Bitmap

type Bitmap Word

Bitmaps of <= 63 are stored as positive int64s. Negative int64s are indices into pool of all known bitmaps

func (Bitmap) AndNot

func (b Bitmap) AndNot(c Bitmap) Bitmap

func (Bitmap) AndNotx

func (b Bitmap) AndNotx(x uint) Bitmap

func (Bitmap) Dup

func (b Bitmap) Dup() Bitmap

func (Bitmap) ForeachSetBit

func (b Bitmap) ForeachSetBit(fn func(uint))

func (Bitmap) Free

func (b Bitmap) Free() Bitmap

func (Bitmap) Get

func (b Bitmap) Get(x uint) bool

func (Bitmap) GetMultiple

func (b Bitmap) GetMultiple(x, n_bits uint) (v Word)

func (Bitmap) HexString

func (b Bitmap) HexString() string

func (Bitmap) Invert

func (b Bitmap) Invert(x uint) Bitmap

func (Bitmap) Invert2

func (b Bitmap) Invert2(x uint) (Bitmap, bool)

func (Bitmap) Next

func (b Bitmap) Next(px *uint) bool

func (Bitmap) Or

func (b Bitmap) Or(c Bitmap) Bitmap

func (Bitmap) Orx

func (b Bitmap) Orx(x uint) Bitmap

func (Bitmap) Set

func (b Bitmap) Set(x uint) Bitmap

func (Bitmap) Set2

func (b Bitmap) Set2(x uint) (Bitmap, bool)

func (Bitmap) SetMultiple

func (b Bitmap) SetMultiple(x, n_bits uint, new_value Word) (r Bitmap, old_value Word)

func (Bitmap) String

func (b Bitmap) String() string

type BitmapPool

type BitmapPool struct {
	Pool
	// contains filtered or unexported fields
}

func (*BitmapPool) AndNot

func (p *BitmapPool) AndNot(b Bitmap, c Bitmap) (r Bitmap)

func (*BitmapPool) AndNotx

func (p *BitmapPool) AndNotx(b Bitmap, x uint) (r Bitmap)

func (*BitmapPool) Dup

func (p *BitmapPool) Dup(b Bitmap) Bitmap

Dup copies given bitmap

func (*BitmapPool) Elts

func (p *BitmapPool) Elts() uint

func (*BitmapPool) Foreach

func (p *BitmapPool) Foreach(f func(x WordVec))

func (*BitmapPool) ForeachIndex

func (p *BitmapPool) ForeachIndex(f func(i uint))

func (*BitmapPool) ForeachSetBit

func (p *BitmapPool) ForeachSetBit(b Bitmap, fn func(uint))

func (*BitmapPool) Free

func (p *BitmapPool) Free(b Bitmap) Bitmap

Free bitmap so it can be reused later. Returns zero bitmap.

func (*BitmapPool) Get

func (p *BitmapPool) Get(b Bitmap, x uint) (v bool)

func (*BitmapPool) GetIndex

func (p *BitmapPool) GetIndex() (i uint)

func (*BitmapPool) HexString

func (p *BitmapPool) HexString(b Bitmap) string

func (*BitmapPool) Invert

func (p *BitmapPool) Invert(b Bitmap, x uint) (r Bitmap)

func (*BitmapPool) Invert2

func (p *BitmapPool) Invert2(b Bitmap, x uint) (r Bitmap, v bool)

func (*BitmapPool) IsFree

func (p *BitmapPool) IsFree(i uint) (v bool)

func (*BitmapPool) Len

func (p *BitmapPool) Len() uint

func (*BitmapPool) Next

func (p *BitmapPool) Next(b Bitmap, px *uint) (ok bool)

func (*BitmapPool) Or

func (p *BitmapPool) Or(b Bitmap, c Bitmap) (r Bitmap)

func (*BitmapPool) Orx

func (p *BitmapPool) Orx(b Bitmap, x uint) (r Bitmap)

func (*BitmapPool) PutIndex

func (p *BitmapPool) PutIndex(i uint) (ok bool)

func (*BitmapPool) Reset

func (p *BitmapPool) Reset()

func (*BitmapPool) Resize

func (p *BitmapPool) Resize(n uint)

func (*BitmapPool) Set

func (p *BitmapPool) Set(b Bitmap, x uint) (r Bitmap)

func (*BitmapPool) Set2

func (p *BitmapPool) Set2(b Bitmap, x uint) (r Bitmap, v bool)

Set2 sets bit X in given bitmap, possibly resizeing and returning new bitmap. Second return value is old value of bit X or false if bit is newly created.

func (*BitmapPool) String

func (p *BitmapPool) String(b Bitmap) string

func (*BitmapPool) Unset

func (p *BitmapPool) Unset(b Bitmap, x uint) (r Bitmap)

func (*BitmapPool) Unset2

func (p *BitmapPool) Unset2(b Bitmap, x uint) (r Bitmap, old bool)

func (*BitmapPool) Validate

func (p *BitmapPool) Validate(i uint)

type BitmapVec

type BitmapVec []Bitmap

func (BitmapVec) Len

func (p BitmapVec) Len() uint

func (*BitmapVec) ResetLen

func (p *BitmapVec) ResetLen()

func (*BitmapVec) Resize

func (p *BitmapVec) Resize(n uint)

func (*BitmapVec) Validate

func (p *BitmapVec) Validate(i uint) *Bitmap

func (*BitmapVec) ValidateInit

func (p *BitmapVec) ValidateInit(i uint, zero Bitmap) *Bitmap

func (*BitmapVec) ValidateLen

func (p *BitmapVec) ValidateLen(l uint) (v *Bitmap)

func (*BitmapVec) ValidateLenInit

func (p *BitmapVec) ValidateLenInit(l uint, zero Bitmap) (v *Bitmap)

type BitmapsVec

type BitmapsVec [][]BitmapVec

func (BitmapsVec) Len

func (p BitmapsVec) Len() uint

func (*BitmapsVec) ResetLen

func (p *BitmapsVec) ResetLen()

func (*BitmapsVec) Resize

func (p *BitmapsVec) Resize(n uint)

func (*BitmapsVec) Validate

func (p *BitmapsVec) Validate(i uint) *[]BitmapVec

func (*BitmapsVec) ValidateInit

func (p *BitmapsVec) ValidateInit(i uint, zero []BitmapVec) *[]BitmapVec

func (*BitmapsVec) ValidateLen

func (p *BitmapsVec) ValidateLen(l uint) (v *[]BitmapVec)

func (*BitmapsVec) ValidateLenInit

func (p *BitmapsVec) ValidateLenInit(l uint, zero []BitmapVec) (v *[]BitmapVec)

type ByteVec

type ByteVec []byte

func (ByteVec) Len

func (p ByteVec) Len() uint

func (*ByteVec) ResetLen

func (p *ByteVec) ResetLen()

func (*ByteVec) Resize

func (p *ByteVec) Resize(n uint)

func (*ByteVec) Validate

func (p *ByteVec) Validate(i uint) *byte

func (*ByteVec) ValidateInit

func (p *ByteVec) ValidateInit(i uint, zero byte) *byte

func (*ByteVec) ValidateLen

func (p *ByteVec) ValidateLen(l uint) (v *byte)

func (*ByteVec) ValidateLenInit

func (p *ByteVec) ValidateLenInit(l uint, zero byte) (v *byte)

type Cap

type Cap uint

Standard vector capacities of the form 2^i + 2^j i >= j.

func (Cap) IsValid

func (c Cap) IsValid() bool

True if removing first set bit gives a power of 2.

func (Cap) Log2

func (c Cap) Log2() (i, j Cap)

func (Cap) Next

func (c Cap) Next() Cap

func (Cap) NextUnit

func (c Cap) NextUnit(log2Min, log2Unit Cap) (n Cap)

func (Cap) Pow2

func (c Cap) Pow2() (i, j Cap)

func (Cap) Round

func (n Cap) Round(log2Unit Cap) Cap

type Count

type Count int

Count implements the Value interface so flags can be specified as either integer (1000000) or sometimes more conveniently as floating point (1e6).

func (*Count) Set

func (t *Count) Set(s string) (err error)

func (*Count) String

func (t *Count) String() string

type FibHeap

type FibHeap struct {
	// contains filtered or unexported fields
}

func (*FibHeap) Add

func (f *FibHeap) Add(xi uint)

Add a new index to heap.

func (*FibHeap) Del

func (f *FibHeap) Del(i uint)

Del deletes given index from heap.

func (*FibHeap) Merge

func (f *FibHeap) Merge(g *FibHeap)

func (*FibHeap) Min

func (f *FibHeap) Min(data Ordered) (minu uint, valid bool)

func (*FibHeap) String

func (f *FibHeap) String() string

func (*FibHeap) Update

func (f *FibHeap) Update(xi uint)

Update node when data ordering changes (lower key)

type Float32Vec

type Float32Vec []float32

func (Float32Vec) Len

func (p Float32Vec) Len() uint

func (*Float32Vec) ResetLen

func (p *Float32Vec) ResetLen()

func (*Float32Vec) Resize

func (p *Float32Vec) Resize(n uint)

func (*Float32Vec) Validate

func (p *Float32Vec) Validate(i uint) *float32

func (*Float32Vec) ValidateInit

func (p *Float32Vec) ValidateInit(i uint, zero float32) *float32

func (*Float32Vec) ValidateLen

func (p *Float32Vec) ValidateLen(l uint) (v *float32)

func (*Float32Vec) ValidateLenInit

func (p *Float32Vec) ValidateLenInit(l uint, zero float32) (v *float32)

type Float64Vec

type Float64Vec []float64

func (Float64Vec) Len

func (p Float64Vec) Len() uint

func (*Float64Vec) ResetLen

func (p *Float64Vec) ResetLen()

func (*Float64Vec) Resize

func (p *Float64Vec) Resize(n uint)

func (*Float64Vec) Validate

func (p *Float64Vec) Validate(i uint) *float64

func (*Float64Vec) ValidateInit

func (p *Float64Vec) ValidateInit(i uint, zero float64) *float64

func (*Float64Vec) ValidateLen

func (p *Float64Vec) ValidateLen(l uint) (v *float64)

func (*Float64Vec) ValidateLenInit

func (p *Float64Vec) ValidateLenInit(l uint, zero float64) (v *float64)

type Hash

type Hash struct {
	Hasher Hasher
	// contains filtered or unexported fields
}

func (*Hash) Cap

func (h *Hash) Cap() uint

func (*Hash) Clear

func (h *Hash) Clear()

func (*Hash) Elts

func (h *Hash) Elts() uint

func (*Hash) ForeachIndex

func (h *Hash) ForeachIndex(f func(i uint))

func (*Hash) Get

func (h *Hash) Get(k HasherKey) (i uint, ok bool)

func (*Hash) Init

func (h *Hash) Init(r Hasher, cap uint)

func (*Hash) IsFree

func (h *Hash) IsFree(i uint) bool

func (*Hash) NextIndex

func (h *Hash) NextIndex(i uint) uint

func (*Hash) RandIndex

func (h *Hash) RandIndex() uint

func (*Hash) Set

func (h *Hash) Set(k HasherKey) (i uint, exists bool)

func (*Hash) String

func (h *Hash) String() string

func (*Hash) Unset

func (h *Hash) Unset(k HasherKey) (i uint, ok bool)

type HashResizeCopy

type HashResizeCopy struct{ Src, Dst uint }

type HashState

type HashState [2]hash64

func (*HashState) Finalize

func (s *HashState) Finalize(h0, h1, h2, h3 hash64)

Finalize hash state.

func (*HashState) HashPointer

func (s *HashState) HashPointer(p unsafe.Pointer, size uintptr)

func (*HashState) HashUint64

func (s *HashState) HashUint64(x0, x1, x2, x3 uint64)

func (*HashState) Init

func (s *HashState) Init() (hash64, hash64, hash64, hash64)

func (*HashState) MixPointer

func (s *HashState) MixPointer(h0, h1, h2, h3 hash64, p unsafe.Pointer, size uintptr) (hash64, hash64, hash64, hash64)

Mix data given by pointer and size into hash state.

func (*HashState) MixUint64

func (s *HashState) MixUint64(h0, h1, h2, h3 hash64, x0, x1, x2, x3 uint64) (hash64, hash64, hash64, hash64)

Mix up to 256 bits of data x0..x3 into hash state.

type Hasher

type Hasher interface {
	// Compute hash for key with given index.
	HashIndex(s *HashState, i uint)

	// Hash has just been resized to new capacity.
	// Function must copy elements from old table to new table.
	HashResize(newCap uint, copies []HashResizeCopy)
}

type HasherKey

type HasherKey interface {
	// Compute hash for key.
	HashKey(s *HashState)

	// k0.Equal(keys[i]) returns k0 == k1.
	HashKeyEqual(h Hasher, i uint) bool
}

type Heap

type Heap struct {
	// contains filtered or unexported fields
}

A Heap maintains an allocator for arbitrary sized blocks of an underlying array. The array is not part of the Heap.

func (*Heap) Foreach

func (heap *Heap) Foreach(f func(offset, len uint))

func (*Heap) Get

func (heap *Heap) Get(size uint) (id Index, offset uint)

func (*Heap) GetAligned

func (heap *Heap) GetAligned(sizeArg, log2Alignment uint) (id Index, offset uint)

func (*Heap) GetID

func (heap *Heap) GetID(ei Index) (offset, len int)

func (*Heap) GetMaxLen

func (heap *Heap) GetMaxLen() uint

func (*Heap) GetUsage

func (heap *Heap) GetUsage() (u HeapUsage)

func (*Heap) IsFree

func (heap *Heap) IsFree(ei Index) bool

func (*Heap) Len

func (heap *Heap) Len(ei Index) uint

func (*Heap) Put

func (heap *Heap) Put(ei Index)

func (*Heap) SetMaxLen

func (heap *Heap) SetMaxLen(l uint)

func (*Heap) String

func (heap *Heap) String() (s string)

type HeapUsage

type HeapUsage struct {
	Used, Free uint64
}

type Index

type Index uint32

Index gives common type for indices in Heaps, Pools, Fifos, ...

const MaxIndex Index = ^Index(0)

type Int16Vec

type Int16Vec []int16

func (Int16Vec) Len

func (p Int16Vec) Len() uint

func (*Int16Vec) ResetLen

func (p *Int16Vec) ResetLen()

func (*Int16Vec) Resize

func (p *Int16Vec) Resize(n uint)

func (*Int16Vec) Validate

func (p *Int16Vec) Validate(i uint) *int16

func (*Int16Vec) ValidateInit

func (p *Int16Vec) ValidateInit(i uint, zero int16) *int16

func (*Int16Vec) ValidateLen

func (p *Int16Vec) ValidateLen(l uint) (v *int16)

func (*Int16Vec) ValidateLenInit

func (p *Int16Vec) ValidateLenInit(l uint, zero int16) (v *int16)

type Int32Vec

type Int32Vec []int32

func (Int32Vec) Len

func (p Int32Vec) Len() uint

func (*Int32Vec) ResetLen

func (p *Int32Vec) ResetLen()

func (*Int32Vec) Resize

func (p *Int32Vec) Resize(n uint)

func (*Int32Vec) Validate

func (p *Int32Vec) Validate(i uint) *int32

func (*Int32Vec) ValidateInit

func (p *Int32Vec) ValidateInit(i uint, zero int32) *int32

func (*Int32Vec) ValidateLen

func (p *Int32Vec) ValidateLen(l uint) (v *int32)

func (*Int32Vec) ValidateLenInit

func (p *Int32Vec) ValidateLenInit(l uint, zero int32) (v *int32)

type Int64Vec

type Int64Vec []int64

func (Int64Vec) Len

func (p Int64Vec) Len() uint

func (*Int64Vec) ResetLen

func (p *Int64Vec) ResetLen()

func (*Int64Vec) Resize

func (p *Int64Vec) Resize(n uint)

func (*Int64Vec) Validate

func (p *Int64Vec) Validate(i uint) *int64

func (*Int64Vec) ValidateInit

func (p *Int64Vec) ValidateInit(i uint, zero int64) *int64

func (*Int64Vec) ValidateLen

func (p *Int64Vec) ValidateLen(l uint) (v *int64)

func (*Int64Vec) ValidateLenInit

func (p *Int64Vec) ValidateLenInit(l uint, zero int64) (v *int64)

type Int8Vec

type Int8Vec []int8

func (Int8Vec) Len

func (p Int8Vec) Len() uint

func (*Int8Vec) ResetLen

func (p *Int8Vec) ResetLen()

func (*Int8Vec) Resize

func (p *Int8Vec) Resize(n uint)

func (*Int8Vec) Validate

func (p *Int8Vec) Validate(i uint) *int8

func (*Int8Vec) ValidateInit

func (p *Int8Vec) ValidateInit(i uint, zero int8) *int8

func (*Int8Vec) ValidateLen

func (p *Int8Vec) ValidateLen(l uint) (v *int8)

func (*Int8Vec) ValidateLenInit

func (p *Int8Vec) ValidateLenInit(l uint, zero int8) (v *int8)

type Lines

type Lines []string

func (*Lines) Add

func (l *Lines) Add(s string)

func (Lines) Indent

func (l Lines) Indent(indent uint) (s string)

type MemHeap

type MemHeap struct {
	// contains filtered or unexported fields
}

Allocation heap of cache lines.

func (*MemHeap) Data

func (h *MemHeap) Data(o uint) unsafe.Pointer

func (*MemHeap) Get

func (h *MemHeap) Get(n uint) (b []byte, id Index, offset, cap uint)

func (*MemHeap) GetAligned

func (h *MemHeap) GetAligned(n, log2Align uint) (b []byte, id Index, offset, cap uint)

func (*MemHeap) GetId

func (h *MemHeap) GetId(id Index) (b []byte)

func (*MemHeap) Init

func (h *MemHeap) Init(n uint) (err error)

func (*MemHeap) InitData

func (h *MemHeap) InitData(b []byte)

func (*MemHeap) Offset

func (h *MemHeap) Offset(b []byte) uint

func (*MemHeap) OffsetValid

func (h *MemHeap) OffsetValid(o uint) bool

func (*MemHeap) Put

func (h *MemHeap) Put(id Index)

func (*MemHeap) String

func (h *MemHeap) String() string

type MemorySize

type MemorySize uint64

func (MemorySize) String

func (s MemorySize) String() (v string)

type Ordered

type Ordered interface {
	// Returns negative, zero, positive if element i is less, equal, greater than element j
	Compare(i, j int) int
}

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func (*Pool) FreeLen

func (p *Pool) FreeLen() uint

func (*Pool) GetIndex

func (p *Pool) GetIndex(max uint) (i uint)

Get first free pool index if available.

func (*Pool) IsFree

func (p *Pool) IsFree(i uint) (ok bool)

func (*Pool) MaxLen

func (p *Pool) MaxLen() uint

func (*Pool) PutIndex

func (p *Pool) PutIndex(i uint) (ok bool)

Put (free) given pool index.

func (*Pool) Reset

func (p *Pool) Reset()

func (*Pool) SetMaxLen

func (p *Pool) SetMaxLen(x uint)

type Sparse

type Sparse struct {
	// contains filtered or unexported fields
}

Sparse arrays map sparse indices into dense indices.

func (*Sparse) Get

func (s *Sparse) Get(sparse Index) (dense Index, valid bool)

func (*Sparse) Set

func (s *Sparse) Set(sparse Index) (dense Index)

func (*Sparse) String

func (s *Sparse) String() string

func (*Sparse) Unset

func (s *Sparse) Unset(sparse Index) (valid bool)

type StringPool

type StringPool struct {
	Pool
	Strings []string
}

func (*StringPool) Elts

func (p *StringPool) Elts() uint

func (*StringPool) Foreach

func (p *StringPool) Foreach(f func(x string))

func (*StringPool) ForeachIndex

func (p *StringPool) ForeachIndex(f func(i uint))

func (*StringPool) GetIndex

func (p *StringPool) GetIndex() (i uint)

func (*StringPool) IsFree

func (p *StringPool) IsFree(i uint) (v bool)

func (*StringPool) Len

func (p *StringPool) Len() uint

func (*StringPool) PutIndex

func (p *StringPool) PutIndex(i uint) (ok bool)

func (*StringPool) Reset

func (p *StringPool) Reset()

func (*StringPool) Resize

func (p *StringPool) Resize(n uint)

func (*StringPool) Validate

func (p *StringPool) Validate(i uint)

type StringVec

type StringVec []string

func (StringVec) Len

func (p StringVec) Len() uint

func (*StringVec) ResetLen

func (p *StringVec) ResetLen()

func (*StringVec) Resize

func (p *StringVec) Resize(n uint)

func (*StringVec) Validate

func (p *StringVec) Validate(i uint) *string

func (*StringVec) ValidateInit

func (p *StringVec) ValidateInit(i uint, zero string) *string

func (*StringVec) ValidateLen

func (p *StringVec) ValidateLen(l uint) (v *string)

func (*StringVec) ValidateLenInit

func (p *StringVec) ValidateLenInit(l uint, zero string) (v *string)

type TypedPool

type TypedPool struct {
	// contains filtered or unexported fields
}

func (*TypedPool) Data

func (*TypedPool) FreeLen

func (p *TypedPool) FreeLen() uint

func (*TypedPool) GetData

func (*TypedPool) GetIndex

func (p *TypedPool) GetIndex(typ TypedPoolType) (i TypedPoolIndex)

func (*TypedPool) Init

func (p *TypedPool) Init(args ...interface{})

func (*TypedPool) IsFree

func (p *TypedPool) IsFree(i uint) (ok bool)

func (*TypedPool) IsInitialized

func (p *TypedPool) IsInitialized() bool

func (*TypedPool) MaxLen

func (p *TypedPool) MaxLen() uint

func (*TypedPool) PutIndex

func (p *TypedPool) PutIndex(t TypedPoolType, i TypedPoolIndex) (ok bool)

func (*TypedPool) SetMaxLen

func (p *TypedPool) SetMaxLen(x uint)

type TypedPoolIndex

type TypedPoolIndex uint32

type TypedPoolType

type TypedPoolType uint32

type Uint16Vec

type Uint16Vec []uint16

func (Uint16Vec) Len

func (p Uint16Vec) Len() uint

func (*Uint16Vec) ResetLen

func (p *Uint16Vec) ResetLen()

func (*Uint16Vec) Resize

func (p *Uint16Vec) Resize(n uint)

func (*Uint16Vec) Validate

func (p *Uint16Vec) Validate(i uint) *uint16

func (*Uint16Vec) ValidateInit

func (p *Uint16Vec) ValidateInit(i uint, zero uint16) *uint16

func (*Uint16Vec) ValidateLen

func (p *Uint16Vec) ValidateLen(l uint) (v *uint16)

func (*Uint16Vec) ValidateLenInit

func (p *Uint16Vec) ValidateLenInit(l uint, zero uint16) (v *uint16)

type Uint32Vec

type Uint32Vec []uint32

func (Uint32Vec) Len

func (p Uint32Vec) Len() uint

func (*Uint32Vec) ResetLen

func (p *Uint32Vec) ResetLen()

func (*Uint32Vec) Resize

func (p *Uint32Vec) Resize(n uint)

func (*Uint32Vec) Validate

func (p *Uint32Vec) Validate(i uint) *uint32

func (*Uint32Vec) ValidateInit

func (p *Uint32Vec) ValidateInit(i uint, zero uint32) *uint32

func (*Uint32Vec) ValidateLen

func (p *Uint32Vec) ValidateLen(l uint) (v *uint32)

func (*Uint32Vec) ValidateLenInit

func (p *Uint32Vec) ValidateLenInit(l uint, zero uint32) (v *uint32)

type Uint64Vec

type Uint64Vec []uint64

func (Uint64Vec) Len

func (p Uint64Vec) Len() uint

func (*Uint64Vec) ResetLen

func (p *Uint64Vec) ResetLen()

func (*Uint64Vec) Resize

func (p *Uint64Vec) Resize(n uint)

func (*Uint64Vec) Validate

func (p *Uint64Vec) Validate(i uint) *uint64

func (*Uint64Vec) ValidateInit

func (p *Uint64Vec) ValidateInit(i uint, zero uint64) *uint64

func (*Uint64Vec) ValidateLen

func (p *Uint64Vec) ValidateLen(l uint) (v *uint64)

func (*Uint64Vec) ValidateLenInit

func (p *Uint64Vec) ValidateLenInit(l uint, zero uint64) (v *uint64)

type Uint8Vec

type Uint8Vec []uint8

func (Uint8Vec) Len

func (p Uint8Vec) Len() uint

func (*Uint8Vec) ResetLen

func (p *Uint8Vec) ResetLen()

func (*Uint8Vec) Resize

func (p *Uint8Vec) Resize(n uint)

func (*Uint8Vec) Validate

func (p *Uint8Vec) Validate(i uint) *uint8

func (*Uint8Vec) ValidateInit

func (p *Uint8Vec) ValidateInit(i uint, zero uint8) *uint8

func (*Uint8Vec) ValidateLen

func (p *Uint8Vec) ValidateLen(l uint) (v *uint8)

func (*Uint8Vec) ValidateLenInit

func (p *Uint8Vec) ValidateLenInit(l uint, zero uint8) (v *uint8)

type Word

type Word uintptr

Underlying machine word, typically 32 or 64 bits.

func FirstSet

func FirstSet(x Word) Word

firstSet gives 2^f where f is the lowest 1 bit in x

func MaxPow2

func MaxPow2(x Word) Word

func NextSet

func NextSet(x Word) (v Word, i int)

func RoundCacheLine

func RoundCacheLine(x Word) Word

func RoundPow2

func RoundPow2(x, p Word) Word

roundPow2 rounds x to next power of two >= x

func (Word) BitmapIndex

func (i Word) BitmapIndex() (Word, Word)

Helper to index word sized bitmaps.

func (Word) FirstSet

func (x Word) FirstSet() Word

func (Word) ForeachSetBit

func (x Word) ForeachSetBit(fn func(i uint))

func (Word) IsPow2

func (x Word) IsPow2() bool

func (Word) MaxLog2

func (x Word) MaxLog2() uint

func (Word) MaxPow2

func (x Word) MaxPow2() Word

func (Word) MinLog2

func (x Word) MinLog2() uint

func (Word) NLeadingZeros

func (x Word) NLeadingZeros() uint

func (Word) NSetBits

func (x Word) NSetBits() uint

func (Word) NextSet

func (x Word) NextSet() (Word, int)

func (Word) RoundCacheLine

func (x Word) RoundCacheLine() Word

func (Word) RoundPow2

func (x Word) RoundPow2(p Word) Word

type WordVec

type WordVec []Word

func (*WordVec) Alloc

func (bm *WordVec) Alloc(nBits uint)

func (WordVec) GetBit

func (bm WordVec) GetBit(x uint) (v bool)

func (*WordVec) GetMultiple

func (bm *WordVec) GetMultiple(x, n_bits uint) (v Word)

Fetch bits I through I + N_BITS.

func (WordVec) Len

func (p WordVec) Len() uint

func (*WordVec) ResetLen

func (p *WordVec) ResetLen()

func (*WordVec) Resize

func (p *WordVec) Resize(n uint)

func (WordVec) SetBit

func (bm WordVec) SetBit(x uint, v bool) (oldValue bool)

func (*WordVec) SetMultiple

func (bm *WordVec) SetMultiple(x, n_bits uint, new_value Word) (old_value Word)

Give bits I through I + N_BITS to new value; return old value.

func (WordVec) UnsetBit

func (bm WordVec) UnsetBit(x uint) (v bool)

func (*WordVec) Validate

func (p *WordVec) Validate(i uint) *Word

func (*WordVec) ValidateInit

func (p *WordVec) ValidateInit(i uint, zero Word) *Word

func (*WordVec) ValidateLen

func (p *WordVec) ValidateLen(l uint) (v *Word)

func (*WordVec) ValidateLenInit

func (p *WordVec) ValidateLenInit(l uint, zero Word) (v *Word)

Directories

Path Synopsis
Package srpc gives symmetric bi-directional RPC on top of GO rpc.
Package srpc gives symmetric bi-directional RPC on top of GO rpc.
dep
High speed event logging
High speed event logging
hw
Memory mapped register read/write
Memory mapped register read/write
pci
Generic devices on PCI bus.
Generic devices on PCI bus.
math
r2

Jump to

Keyboard shortcuts

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