types

package
v0.0.0-...-a0055f1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BigInt

type BigInt struct {
	Bigint *big.Int
}

A BigInt represents a signed multi-precision integer.

func NewBigInt

func NewBigInt(x int64) *BigInt

NewBigint allocates and returns a new BigInt set to x.

func (*BigInt) GetBytes

func (bi *BigInt) GetBytes() []byte

GetBytes returns the absolute value of x as a big-endian byte slice.

func (*BigInt) GetInt64

func (bi *BigInt) GetInt64() int64

GetInt64 returns the int64 representation of x. If x cannot be represented in an int64, the result is undefined.

func (*BigInt) GetLeftPaddedBytes

func (bi *BigInt) GetLeftPaddedBytes(length int) ([]byte, error)

GetBytes returns the absolute value of x as a big-endian byte slice.

func (*BigInt) GetString

func (bi *BigInt) GetString(base int) string

GetString returns the value of x as a formatted string in some number base.

func (*BigInt) SetBytes

func (bi *BigInt) SetBytes(buf []byte)

SetBytes interprets buf as the bytes of a big-endian unsigned integer and sets the big int to that value.

func (*BigInt) SetInt64

func (bi *BigInt) SetInt64(x int64)

SetInt64 sets the big int to x.

func (*BigInt) SetString

func (bi *BigInt) SetString(x string, base int)

SetString sets the big int to x.

The string prefix determines the actual conversion base. A prefix of "0x" or "0X" selects base 16; the "0" prefix selects base 8, and a "0b" or "0B" prefix selects base 2. Otherwise the selected base is 10.

func (*BigInt) Sign

func (bi *BigInt) Sign() int

Sign returns:

-1 if x <  0
 0 if x == 0
+1 if x >  0

func (*BigInt) String

func (bi *BigInt) String() string

String returns the value of x as a formatted decimal string.

type BigInts

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

BigInts represents a slice of big ints.

func (*BigInts) Get

func (bi *BigInts) Get(index int) (Bigint *BigInt, _ error)

Get returns the Bigint at the given index from the slice.

func (*BigInts) Set

func (bi *BigInts) Set(index int, Bigint *BigInt) error

Set sets the big int at the given index in the slice.

func (*BigInts) Size

func (bi *BigInts) Size() int

Size returns the number of big ints in the slice.

Jump to

Keyboard shortcuts

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