identity

package
v3.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Durations

func Durations(durs []time.Duration) uint64

Durations returns the accumulated identity of durs.

func Float64s

func Float64s(f64s []float64) uint64

Float64s returns the accumulated identity of f64s.

func Int64s

func Int64s(i64s []int64) uint64

Int64s returns the accumulated identity of i64s.

func StringStringMap

func StringStringMap(m map[string]string) uint64

StringStringMap returns the accumulated identity of m.

Types

type Accumulator

type Accumulator uint64

Accumulator is a commutative folding accumulator.

func NewAccumulator

func NewAccumulator() Accumulator

NewAccumulator creates a new Accumulator with a default seed value.

n.b. Here and elsewhere, we use nosplit to avoid stack size checks, which

are unnecessary as memory width is bounded to each instance of `a` (a
uint64) and, potentially, a single stack-local loop temporary while
iterating.

func NewAccumulatorWithSeed

func NewAccumulatorWithSeed(seed uint64) Accumulator

NewAccumulatorWithSeed creates a new Accumulator with the provided seed value.

func (Accumulator) AddString

func (a Accumulator) AddString(str string) Accumulator

AddString hashes str and folds it into the accumulator.

func (Accumulator) AddUint64

func (a Accumulator) AddUint64(u64 uint64) Accumulator

AddUint64 folds u64 into the accumulator.

func (Accumulator) Value

func (a Accumulator) Value() uint64

Value returns the accumulated value.

Jump to

Keyboard shortcuts

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