math

package
v0.0.0-...-328c054 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxInt8   = 1<<7 - 1
	MinInt8   = -1 << 7
	MaxInt16  = 1<<15 - 1
	MinInt16  = -1 << 15
	MaxInt32  = 1<<31 - 1
	MinInt32  = -1 << 31
	MaxInt64  = 1<<63 - 1
	MinInt64  = -1 << 63
	MaxUint8  = 1<<8 - 1
	MaxUint16 = 1<<16 - 1
	MaxUint32 = 1<<32 - 1
	MaxUint64 = 1<<64 - 1
)

Integer limit values.

Variables

View Source
var (
	Big0      = big.NewInt(0)
	Big1      = big.NewInt(1)
	Big3      = big.NewInt(3)
	Big4      = big.NewInt(4)
	Big7      = big.NewInt(7)
	Big8      = big.NewInt(8)
	Big16     = big.NewInt(16)
	Big20     = big.NewInt(20)
	Big32     = big.NewInt(32)
	Big64     = big.NewInt(64)
	Big96     = big.NewInt(96)
	Big480    = big.NewInt(480)
	Big1024   = big.NewInt(1024)
	Big3072   = big.NewInt(3072)
	Big199680 = big.NewInt(199680)
)

Functions

func BigGreaterThan

func BigGreaterThan(first, second *big.Int) bool

func BigMax

func BigMax(first, second *big.Int) *big.Int

func MustParseUint64

func MustParseUint64(s string) uint64

MustParseUint64 parses s as an integer and panics if the string is invalid.

func ParseUint64

func ParseUint64(s string) (uint64, bool)

ParseUint64 parses s as an integer in decimal or hexadecimal syntax. Leading zeros are accepted. The empty string parses as zero.

func SafeAdd

func SafeAdd(x, y uint64) (uint64, bool)

SafeAdd returns x+y and checks for overflow.

func SafeMul

func SafeMul(x, y uint64) (uint64, bool)

SafeMul returns x*y and checks for overflow.

func SafeSub

func SafeSub(x, y uint64) (uint64, bool)

SafeSub returns x-y and checks for overflow.

Types

This section is empty.

Jump to

Keyboard shortcuts

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