uint256

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Uint256

type Uint256 struct {
	// contains filtered or unexported fields
}

Uint256 is an unsigned 256-bit integer

func BaseDatasizeConst

func BaseDatasizeConst() *Uint256

BaseDatasizeConst returns constants.BaseDatasizeConst as Uint256

func DSPIMinDeposit

func DSPIMinDeposit() *Uint256

DSPIMinDeposit returns constants.DSPIMinDeposit as Uint256

func One

func One() *Uint256

One returns the Uint256 one

func Two

func Two() *Uint256

Two returns the Uint256 two

func Zero

func Zero() *Uint256

Zero returns the Uint256 zero

func (*Uint256) Add

func (u *Uint256) Add(a, b *Uint256) (*Uint256, error)

Add returns u == a + b and returns an error on overflow

func (*Uint256) AddMod

func (u *Uint256) AddMod(a, b, m *Uint256) (*Uint256, error)

AddMod returns u == a + b mod m

func (*Uint256) Clone

func (u *Uint256) Clone() *Uint256

Clone returns a copy of u; will panic if u == nil

func (*Uint256) Cmp

func (u *Uint256) Cmp(a *Uint256) int

Cmp returns 1 if u > a, 0 if u == a, and -1 if u < a

func (*Uint256) Div

func (u *Uint256) Div(a, b *Uint256) (*Uint256, error)

Div returns u == a / b

func (*Uint256) Eq

func (u *Uint256) Eq(a *Uint256) bool

Eq returns u == a

func (*Uint256) FromBigInt

func (u *Uint256) FromBigInt(a *big.Int) (*Uint256, error)

FromBigInt converts big.Int into Uint256

func (*Uint256) FromUint32Array

func (u *Uint256) FromUint32Array(z [8]uint32) error

FromUint32Array takes in an array of uint32 objects and make a Uint256

func (*Uint256) FromUint64

func (u *Uint256) FromUint64(a uint64) (*Uint256, error)

FromUint64 converts a uint64 into Uint256

func (*Uint256) Gt

func (u *Uint256) Gt(a *Uint256) bool

Gt returns u > a

func (*Uint256) Gte

func (u *Uint256) Gte(a *Uint256) bool

Gte returns u >= a

func (*Uint256) Lt

func (u *Uint256) Lt(a *Uint256) bool

Lt returns u < a

func (*Uint256) Lte

func (u *Uint256) Lte(a *Uint256) bool

Lte returns u <= a

func (*Uint256) MarshalBinary

func (u *Uint256) MarshalBinary() ([]byte, error)

MarshalBinary marshals Uint256 to a byte slice

func (*Uint256) MarshalString

func (u *Uint256) MarshalString() (string, error)

MarshalString returns 64 hex-encoded string of Uint256 object

func (*Uint256) Mod

func (u *Uint256) Mod(a, m *Uint256) (*Uint256, error)

Mod returns u == a mod m

func (*Uint256) Mul

func (u *Uint256) Mul(a, b *Uint256) (*Uint256, error)

Mul returns u == a * b and returns an error on overflow

func (*Uint256) MulMod

func (u *Uint256) MulMod(a, b, m *Uint256) (*Uint256, error)

MulMod returns u == a * b mod m

func (*Uint256) SetOne

func (u *Uint256) SetOne() *Uint256

SetOne sets u to 1

func (*Uint256) SetZero

func (u *Uint256) SetZero() *Uint256

SetZero sets u to 0

func (*Uint256) String

func (u *Uint256) String() string

String returns the result of MarshalString

func (*Uint256) Sub

func (u *Uint256) Sub(a, b *Uint256) (*Uint256, error)

Sub returns u == a - b and returns an error on overflow

func (*Uint256) ToUint32

func (u *Uint256) ToUint32() (uint32, error)

ToUint32 returns the lowest 32 bits of u and an error if the operation overflows

func (*Uint256) ToUint32Array

func (u *Uint256) ToUint32Array() ([8]uint32, error)

ToUint32Array converts Uint256 into an array of uint32 objects; note that the order is reversed, so that the lower-order uint32 objects have smaller indices.

func (*Uint256) ToUint64

func (u *Uint256) ToUint64() (uint64, error)

ToUint64 returns the lowest 64 bits of u and an error if the operation overflows

func (*Uint256) UnmarshalBinary

func (u *Uint256) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshals a byte slice to a Uint256 object

func (*Uint256) UnmarshalString

func (u *Uint256) UnmarshalString(s string) error

UnmarshalString marshals hex-encoded string to Uint256 object

Jump to

Keyboard shortcuts

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