Documentation ¶
Index ¶
- func Abs[T constraints.Signed](a T) T
- func Clamp[T constraints.Integer](value, a, b T) T
- func ClampCast[T, V constraints.Integer](value T) V
- func Max[T constraints.Ordered](a, b T) T
- func Maxv[T constraints.Ordered](ints ...T) T
- func Min[T constraints.Ordered](a, b T) T
- func Minv[T constraints.Ordered](ints ...T) T
- type Decrementor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 Maxv ¶
func Maxv[T constraints.Ordered](ints ...T) T
Maxv returns the largest int passed in the variadic argument.
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
Click to show internal directories.
Click to hide internal directories.