umath

package
v0.0.0-...-2c24670 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package umath contains helper functions for math on unsigned integers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accumulate

func Accumulate(f func(uint, uint) uint, a []uint) []uint

func Clamp

func Clamp(n, low, high uint) uint

Clamp takes an uint n, returns low if n < low, high if n > high, and n otherwise.

func Filter

func Filter(f func(uint) bool, a []uint) []uint

func Map

func Map(f func(uint) uint, a []uint) []uint

func Max

func Max(n uint, a ...uint) uint

Max returns the largest integer argument.

func Min

func Min(n uint, a ...uint) uint

Min returns the smallest integer argument.

func Pow

func Pow(base, exp uint) uint

Pow is an efficent implementation of exponentiation by squaring.

func Product

func Product(a ...uint) uint

Product returns the product of it's arguments. Product() is 1.

func Range

func Range(start, stop uint, step int) []uint

func Reduce

func Reduce(f func(uint, uint) uint, start uint, a ...uint) uint

func Sum

func Sum(a ...uint) uint

Sum returns the sum of it's arguments. Sum() is 0

Types

This section is empty.

Jump to

Keyboard shortcuts

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