math

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: GPL-3.0 Imports: 3 Imported by: 11

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
)

Variables

View Source
var (
	MaxBig256 = new(big.Int).Set(tt256m1)

	MaxBig63 = new(big.Int).Sub(tt63, big.NewInt(1))
)

Functions

func BigMax

func BigMax(x, y *big.Int) *big.Int

func BigMin

func BigMin(x, y *big.Int) *big.Int

func BigPow

func BigPow(a, b int64) *big.Int

func Byte

func Byte(bigint *big.Int, padlength, n int) byte

func Exp

func Exp(base, exponent *big.Int) *big.Int

func FirstBitSet

func FirstBitSet(v *big.Int) int

func MustParseBig256

func MustParseBig256(s string) *big.Int

func MustParseUint64

func MustParseUint64(s string) uint64

func PaddedBigBytes

func PaddedBigBytes(bigint *big.Int, n int) []byte

func ParseBig256

func ParseBig256(s string) (*big.Int, bool)

func ParseUint64

func ParseUint64(s string) (uint64, bool)

func ReadBits

func ReadBits(bigint *big.Int, buf []byte)

func S256

func S256(x *big.Int) *big.Int

func SafeAdd

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

func SafeMul

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

func SafeSub

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

func U256

func U256(x *big.Int) *big.Int

Types

type HexOrDecimal256

type HexOrDecimal256 big.Int

func (*HexOrDecimal256) MarshalText

func (i *HexOrDecimal256) MarshalText() ([]byte, error)

func (*HexOrDecimal256) UnmarshalText

func (i *HexOrDecimal256) UnmarshalText(input []byte) error

type HexOrDecimal64

type HexOrDecimal64 uint64

func (HexOrDecimal64) MarshalText

func (i HexOrDecimal64) MarshalText() ([]byte, error)

func (*HexOrDecimal64) UnmarshalText

func (i *HexOrDecimal64) UnmarshalText(input []byte) error

Jump to

Keyboard shortcuts

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