shared

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxLoad is the default value for the load factor.
	// It can be changed with `MaxLoad`. This value is a
	// trade-off of runtime and memory consumption.
	DefaultMaxLoad = 0.7

	// DefaultSize is the default for the amount before
	// the first resize happens.
	DefaultSize = 4
)

Variables

View Source
var ErrOutOfRange = errors.New("out of range")

ErrOutOfRange signals an out of range request.

Functions

func NextPowerOf2

func NextPowerOf2(i uint64) uint64

NextPowerOf2 is a fast computation of 2^x see: https://stackoverflow.com/questions/466204/rounding-up-to-next-power-of-2

Types

type HashFn

type HashFn[T any] func(t T) uintptr

HashFn is a function that returns the hash of 't'.

func GetHasher

func GetHasher[Key any]() HashFn[Key]

GetHasher returns a hasher for the golang default types.

Jump to

Keyboard shortcuts

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