int256

package
v0.5.9-0...-ba7202b Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Int256

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

Int256 represents an signed integer of 256 bits

func Int256From

func Int256From(base int64) *Int256

Int256From creates a Int256 struct based on the given int64 param any int64 is valid as a Int256

func NewInt256

func NewInt256(value *big.Int) (*Int256, error)

NewInt256 creates a Int256 struct with an initial underlying value of the given param returns an error when the value cannot be correctly set

func (*Int256) Add

func (u *Int256) Add(augend, addend *Int256) (*Int256, error)

Add sets u to augend + addend and returns u as the sum returns an error when the value cannot be correctly set

func (*Int256) Copy

func (u *Int256) Copy() *Int256

Copy creates and returns a new Int256 instance, with its underlying value set matching the receiver

func (*Int256) DecodeRLP

func (u *Int256) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements the rlp.Decoder interface it makes sure the value field is decoded even though it is private

func (*Int256) EncodeRLP

func (u *Int256) EncodeRLP(w io.Writer) error

EncodeRLP implements the rlp.Encoder interface it makes sure the value field is encoded even though it is private

func (*Int256) Equals

func (u *Int256) Equals(v *Int256) bool

Equals returns true if the two Int256 structs have the same underlying values, false otherwise

func (*Int256) MarshalJSON

func (u *Int256) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface it specifies how to marshal a Int256 struct so that it can be written to disk

func (*Int256) Mul

func (u *Int256) Mul(multiplicand, multiplier *Int256) (*Int256, error)

Mul sets u to multiplicand * multiplier and returns u as the product returns an error when the value cannot be correctly set

func (*Int256) String

func (u *Int256) String() string

String returns the string representation for Int256 structs

func (*Int256) Sub

func (u *Int256) Sub(minuend, subtrahend *Int256) (*Int256, error)

Sub sets u to minuend - subtrahend and returns u as the difference returns an error when the value cannot be correctly set

func (*Int256) UnmarshalJSON

func (u *Int256) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface it specifies how to unmarshal a Int256 struct so that it can be reconstructed from disk

func (*Int256) Value

func (u *Int256) Value() *big.Int

Value returns the underlying private value for a Int256 struct

type Uint256

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

Uint256 represents an unsigned integer of 256 bits

func NewUint256

func NewUint256(value *big.Int) (*Uint256, error)

NewUint256 creates a Uint256 struct with an initial underlying value of the given param returns an error when the value cannot be correctly set

func Uint256From

func Uint256From(base uint64) *Uint256

Uint256From creates a Uint256 struct based on the given uint64 param any uint64 is valid as a Uint256

func (*Uint256) Add

func (u *Uint256) Add(augend, addend *Uint256) (*Uint256, error)

Add sets u to augend + addend and returns u as the sum returns an error when the value cannot be correctly set

func (*Uint256) Cmp

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

Cmp calls the underlying Cmp method for the big.Int stored in a Uint256 struct as its value field

func (*Uint256) Copy

func (u *Uint256) Copy() *Uint256

Copy creates and returns a new Int256 instance, with its underlying value set matching the receiver

func (*Uint256) DecodeRLP

func (u *Uint256) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements the rlp.Decoder interface it makes sure the value field is decoded even though it is private

func (*Uint256) EncodeRLP

func (u *Uint256) EncodeRLP(w io.Writer) error

EncodeRLP implements the rlp.Encoder interface it makes sure the value field is encoded even though it is private

func (*Uint256) Equals

func (u *Uint256) Equals(v *Uint256) bool

Equals returns true if the two Uint256 structs have the same underlying values, false otherwise

func (*Uint256) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface it specifies how to marshal a Uint256 struct so that it can be written to disk

func (*Uint256) Mul

func (u *Uint256) Mul(multiplicand, multiplier *Uint256) (*Uint256, error)

Mul sets u to multiplicand * multiplier and returns u as the product returns an error when the value cannot be correctly set

func (*Uint256) String

func (u *Uint256) String() string

String returns the string representation for Uint256 structs

func (*Uint256) Sub

func (u *Uint256) Sub(minuend, subtrahend *Uint256) (*Uint256, error)

Sub sets u to minuend - subtrahend and returns u as the difference returns an error when the value cannot be correctly set

func (*Uint256) UnmarshalJSON

func (u *Uint256) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface it specifies how to unmarshal a Uint256 struct so that it can be reconstructed from disk

func (*Uint256) Value

func (u *Uint256) Value() *big.Int

Value returns the underlying private value for a Uint256 struct

Jump to

Keyboard shortcuts

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