number

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 6 Imported by: 31

Documentation

Index

Constants

View Source
const MaxWords = 256 / bits.UintSize

Variables

View Source
var (
	Zero      = uint256.NewInt(0)
	Number_1  = uint256.NewInt(1)
	Number_2  = uint256.NewInt(2)
	Number_3  = uint256.NewInt(3)
	Number_4  = uint256.NewInt(4)
	Number_5  = uint256.NewInt(5)
	Number_6  = uint256.NewInt(6)
	Number_7  = uint256.NewInt(7)
	Number_8  = uint256.NewInt(8)
	Number_9  = uint256.NewInt(9)
	Number_10 = uint256.NewInt(10)

	Number_18 = uint256.NewInt(18)

	Number_10000 = uint256.NewInt(10000)

	Number_1e18 = new(uint256.Int).Exp(Number_10, Number_18)
)
View Source
var MaxU256Hex, _ = hex.DecodeString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")

Functions

func Add added in v0.5.0

func Add(x, y *uint256.Int) *uint256.Int

func AddUint64 added in v0.5.0

func AddUint64(x *uint256.Int, y uint64) *uint256.Int

func Div added in v0.5.0

func Div(x, y *uint256.Int) *uint256.Int

func FillBig added in v0.5.1

func FillBig(z *uint256.Int, b *big.Int)

similar to `z.ToBig()` but try to re-use space inside `b` instead of allocating

func Mul added in v0.5.0

func Mul(x, y *uint256.Int) *uint256.Int

func NewUint256

func NewUint256(s string) (res *uint256.Int)

func RandNumberHexString added in v0.5.0

func RandNumberHexString(maxLen int) string

RandNumberHexString generate random string of hex number with length <= maxLen (without 0x prefix)

func RandNumberString added in v0.5.0

func RandNumberString(maxLen int) string

RandNumberString generate random string of number with length <= maxLen

func Set added in v0.5.0

func Set(x *uint256.Int) *uint256.Int

func SetFromBig added in v0.5.0

func SetFromBig(x *big.Int) *uint256.Int

func SetUint64 added in v0.5.0

func SetUint64(x uint64) *uint256.Int

func Sub added in v0.5.0

func Sub(x, y *uint256.Int) *uint256.Int

func SubUint64 added in v0.5.0

func SubUint64(x *uint256.Int, y uint64) *uint256.Int

func TenPow

func TenPow(decimals uint8) *uint256.Int

Types

This section is empty.

Jump to

Keyboard shortcuts

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