big

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const BigIntMaxSerializedLen = 128

BigIntMaxSerializedLen is the max length of a byte slice representing a CBOR serialized big.

Variables

This section is empty.

Functions

func BitLen

func BitLen(a Int) uint

func Cmp

func Cmp(a, b Int) int

Types

type Int

type Int struct {
	*big.Int
}

func Add

func Add(a, b Int) Int

func Div

func Div(a, b Int) Int

func Exp

func Exp(a Int, e Int) Int

Returns a**e unless e <= 0 (in which case returns 1).

func FromBytes

func FromBytes(buf []byte) (Int, error)

func FromString

func FromString(s string) (Int, error)

func Lsh

func Lsh(a Int, n uint) Int

Returns x << n

func Max

func Max(x, y Int) Int

func Min

func Min(x, y Int) Int

func Mod

func Mod(a, b Int) Int

func Mul

func Mul(a, b Int) Int

func NewInt

func NewInt(i int64) Int

func NewIntUnsigned

func NewIntUnsigned(i uint64) Int

func PositiveFromUnsignedBytes

func PositiveFromUnsignedBytes(b []byte) Int

PositiveFromUnsignedBytes interprets b as the bytes of a big-endian unsigned integer and returns a positive Int with this absolute value.

func Rsh

func Rsh(a Int, n uint) Int

Returns x >> n

func Sub

func Sub(a, b Int) Int

func Zero

func Zero() Int

func (*Int) Bytes

func (bi *Int) Bytes() ([]byte, error)

func (Int) Copy

func (bi Int) Copy() Int

func (Int) Equals

func (bi Int) Equals(o Int) bool

Equals returns true if bi == o

func (Int) GreaterThan

func (bi Int) GreaterThan(o Int) bool

GreaterThan returns true if bi > o

func (Int) GreaterThanEqual

func (bi Int) GreaterThanEqual(o Int) bool

GreaterThanEqual returns true if bi >= o

func (*Int) IsZero

func (bi *Int) IsZero() bool

func (Int) LessThan

func (bi Int) LessThan(o Int) bool

LessThan returns true if bi < o

func (Int) LessThanEqual

func (bi Int) LessThanEqual(o Int) bool

LessThanEqual returns true if bi <= o

func (*Int) MarshalBinary

func (bi *Int) MarshalBinary() ([]byte, error)

func (*Int) MarshalCBOR

func (bi *Int) MarshalCBOR(w io.Writer) error

func (*Int) MarshalJSON

func (bi *Int) MarshalJSON() ([]byte, error)

func (Int) Neg

func (bi Int) Neg() Int

Neg returns the negative of bi.

func (*Int) Nil

func (bi *Int) Nil() bool

func (*Int) UnmarshalBinary

func (bi *Int) UnmarshalBinary(buf []byte) error

func (*Int) UnmarshalCBOR

func (bi *Int) UnmarshalCBOR(br io.Reader) error

func (*Int) UnmarshalJSON

func (bi *Int) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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