int256

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OneInt256        = NewInt(1)
	TenInt256        = NewInt(10)
	OneMillionInt256 = NewInt(1_000_000)
)

Functions

This section is empty.

Types

type Int

type Int uint256.Int

func MustFromBig

func MustFromBig(b *big.Int) *Int

MustFromBig creates a new Int from a big.Int. Panics on failure.

func NewInt

func NewInt(val int64) *Int

NewInt creates a new Int from an int64.

func NewUnsignedInt

func NewUnsignedInt(val uint64) *Int

NewUnsignedInt creates a new Int from a uint64.

func (*Int) Abs

func (z *Int) Abs(x *Int) *Int

Abs sets z to the absolute value of x and returns z.

func (*Int) Add

func (z *Int) Add(x, y *Int) *Int

Add sets z = x + y and returns z.

func (*Int) Cmp

func (z *Int) Cmp(x *Int) (r int)

Cmp returns -1 if z < x, 0 if z == x, and +1 if z > x.

func (*Int) Div

func (z *Int) Div(x, y *Int) *Int

Div sets z = x / y and returns z. If y is 0, z is set to 0.

func (*Int) Eq

func (z *Int) Eq(x *Int) bool

Eq returns z == x.

func (*Int) IsZero

func (z *Int) IsZero() bool

IsZero returns true iff z is equal to 0.

func (*Int) Mul

func (z *Int) Mul(x, y *Int) *Int

Mul sets z = x * y and returns z.

func (*Int) MulExp10

func (z *Int) MulExp10(x *Int, y int64) *Int

MulExp10 sets z = x * 10^y and returns z.

func (*Int) Neg

func (z *Int) Neg(x *Int) *Int

Neg sets z to -x and returns z.

func (*Int) Set

func (z *Int) Set(x *Int) *Int

Set sets z to the value of x.

func (*Int) SetUint64

func (z *Int) SetUint64(x uint64) *Int

Set sets z to the value of a uint256.

func (*Int) Sign

func (z *Int) Sign() int

Sign returns -1 if z is negative, 0 if z is zero, and 1 if z is positive.

func (*Int) String

func (z *Int) String() string

func (*Int) Sub

func (z *Int) Sub(x, y *Int) *Int

Sub sets z = x - y and returns z.

func (*Int) ToBig

func (z *Int) ToBig() *big.Int

ToBig converts z to a big.Int.

Jump to

Keyboard shortcuts

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