uint256

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: GPL-3.0 Imports: 4 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 represents an unsigned integer of 256 bits

func FromUint64

func FromUint64(base uint64) *Uint256

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

func New

func New() *Uint256

New creates a Uint256 struct with a minimum initial underlying value

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 result falls outside of the unsigned 256-bit integer range

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(v *Uint256) *Uint256

Copy sets the underlying value of u to a copy of the given Uint256 param, and returns the modified receiver struct

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 result falls outside of the unsigned 256-bit integer range

func (*Uint256) Set

func (u *Uint256) Set(value big.Int) (*Uint256, error)

Set assigns the underlying value of the given Uint256 param to u, and returns the modified receiver struct returns an error when the result falls outside of the unsigned 256-bit integer range

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 result falls outside of the unsigned 256-bit integer range

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