intutil

package
v2.24.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T constraints.Signed](a T) T

Abs value of an int

func Clamp added in v2.3.0

func Clamp[T constraints.Integer](value, a, b T) T

Clamp limits value to a given minimum and maximum

func ClampCast added in v2.23.0

func ClampCast[T, V constraints.Integer](value T) V

ClampCast will clamp a value to the range of V

func Max

func Max[T constraints.Ordered](a, b T) T

Max returns the larger of a or b

func Maxv

func Maxv[T constraints.Ordered](ints ...T) T

Maxv returns the largest int passed in the variadic argument.

func Min

func Min[T constraints.Ordered](a, b T) T

Min returns the smaller of a or b

func Minv

func Minv[T constraints.Ordered](ints ...T) T

Minv returns the smallest int passed in the variadic argument.

Types

type Decrementor

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

Decrementor defines a class that allows multiple threads/processes to act upon to decrement a counter

func NewDecrementor

func NewDecrementor(initialMax int64) *Decrementor

NewDecrementor will return a reference to a Decrementor object

func (*Decrementor) Decrement

func (decrementor *Decrementor) Decrement() int

Decrement will decrement by 1 the initial max the class was instantiated with

func (*Decrementor) GetInitialMax

func (decrementor *Decrementor) GetInitialMax() int

GetInitialMax will return the inital maximum value that was set upon instantiation

Jump to

Keyboard shortcuts

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