safemath

package
v0.8.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(a uint, b uint) (uint, error)

Add adds two uints, reverts on overflow.

func Div

func Div(a uint, b uint) (uint, error)

Div is integer division of two uints truncating the quotient, reverts on division by zero.

func Mod

func Mod(a uint, b uint) (uint, error)

Mod divides two uints and returns the remainder (unsigned integer modulo), reverts when dividing by zero.

func Mul

func Mul(a uint, b uint) (uint, error)

Mul multiplies two uints, error on overflow.

func Sub

func Sub(a uint, b uint) (uint, error)

Sub subtracts two uints, reverts on overflow (i.e. if subtrahend is greater than minuend).

Types

This section is empty.

Jump to

Keyboard shortcuts

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