intutil

package
v2.16.6-prerelease Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MaxUint = ^uint(0)
	MinUint = 0
	MaxInt  = int(MaxUint >> 1)
	MinInt  = -MaxInt - 1
)

Constants

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.Ordered](value, min, max T) T

Clamp limits value to a given minimum and maximum

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