Help us shape the future of Go! Take the 2026 Go Developer Survey

managedbigint

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2019 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Zero = BigIntHandle{
	// contains filtered or unexported fields
}

Zero is a reference to Zero value. Zero doesn't need storage.

Functions

This section is empty.

Types

type BigIntContainer

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

BigIntContainer is a structure holding the data for big.Int numbers without pointers.

func NewBigIntContainer

func NewBigIntContainer() *BigIntContainer

NewBigIntContainer constructs a new BigIntContainer.

func (*BigIntContainer) Abs added in v0.0.3

func (c *BigIntContainer) Abs(dest, x BigIntHandle) BigIntHandle

Abs sets dest to |x| (the absolute value of x).

func (*BigIntContainer) Add

func (c *BigIntContainer) Add(dest, x, y BigIntHandle) BigIntHandle

Add sets dest to the sum x+y.

func (*BigIntContainer) And added in v0.0.3

func (c *BigIntContainer) And(dest, x, y BigIntHandle) BigIntHandle

And sets dest = x & y.

func (*BigIntContainer) AndNot added in v0.0.3

func (c *BigIntContainer) AndNot(dest, x, y BigIntHandle) BigIntHandle

AndNot sets dest = x &^ y.

func (*BigIntContainer) BitLen added in v0.0.3

func (c *BigIntContainer) BitLen(x BigIntHandle) int

BitLen returns the length of the absolute value of x in bits. The bit length of 0 is 0.

func (*BigIntContainer) ByteLen added in v0.0.3

func (c *BigIntContainer) ByteLen(x BigIntHandle) int

ByteLen returns the minimum number of bytes required to represent the absolute value of x. The byte length of 0 is 0.

func (*BigIntContainer) Cmp added in v0.0.3

func (c *BigIntContainer) Cmp(x, y BigIntHandle) int

Cmp compares x and y and returns:

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

func (*BigIntContainer) CmpAbs added in v0.0.3

func (c *BigIntContainer) CmpAbs(x, y BigIntHandle) int

CmpAbs compares the absolute values of x and y and returns:

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

func (*BigIntContainer) Div added in v0.0.3

func (c *BigIntContainer) Div(dest, x, y BigIntHandle) BigIntHandle

Div sets dest to the quotient x/y for y != 0. If y == 0, a division-by-zero run-time panic occurs. Div implements Euclidean division (unlike Go); see DivMod for more details.

func (*BigIntContainer) Get

func (c *BigIntContainer) Get(handler BigIntHandle) *big.Int

Get yields a copy of a BigIntContainer number, as big.Int.

func (*BigIntContainer) GetBytes added in v0.0.3

func (c *BigIntContainer) GetBytes(x BigIntHandle) []byte

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

func (*BigIntContainer) GetUnsafe

func (c *BigIntContainer) GetUnsafe(handler BigIntHandle) *big.Int

GetUnsafe casts a BigIntContainer number to big.Int. Changing the resulting big.Int will also change the underlying data.

func (*BigIntContainer) Insert

func (c *BigIntContainer) Insert(bi *big.Int) BigIntHandle

Insert adds a copy of a big number into the BigIntContainer.

func (*BigIntContainer) InsertUint64

func (c *BigIntContainer) InsertUint64(x uint64) BigIntHandle

InsertUint64 adds a uint64 number into the BigIntContainer.

func (*BigIntContainer) IsInt64 added in v0.0.3

func (c *BigIntContainer) IsInt64(x BigIntHandle) bool

IsInt64 reports whether x can be represented as an int64.

func (*BigIntContainer) Mod added in v0.0.3

func (c *BigIntContainer) Mod(dest, x, y BigIntHandle) BigIntHandle

Mod sets dest to the modulus x%y for y != 0. If y == 0, a division-by-zero run-time panic occurs. Mod implements Euclidean modulus (unlike Go); see DivMod for more details.

func (*BigIntContainer) Mul

func (c *BigIntContainer) Mul(dest, x, y BigIntHandle) BigIntHandle

Mul sets dest to the product x*y.

func (*BigIntContainer) Neg added in v0.0.3

func (c *BigIntContainer) Neg(dest, x BigIntHandle) BigIntHandle

Neg sets dest to -x.

func (*BigIntContainer) Not added in v0.0.3

func (c *BigIntContainer) Not(dest, x BigIntHandle) BigIntHandle

Not sets dest = ^x.

func (*BigIntContainer) Or added in v0.0.3

func (c *BigIntContainer) Or(dest, x, y BigIntHandle) BigIntHandle

Or sets dest = x | y.

func (*BigIntContainer) Quo added in v0.0.3

func (c *BigIntContainer) Quo(dest, x, y BigIntHandle) BigIntHandle

Quo sets dest to the quotient x/y for y != 0. If y == 0, a division-by-zero run-time panic occurs. Quo implements truncated division (like Go); see QuoRem for more details.

func (*BigIntContainer) Rem added in v0.0.3

func (c *BigIntContainer) Rem(dest, x, y BigIntHandle) BigIntHandle

Rem sets dest to the remainder x%y for y != 0. If y == 0, a division-by-zero run-time panic occurs. Rem implements truncated modulus (like Go); see QuoRem for more details.

func (*BigIntContainer) Set added in v0.0.3

func (c *BigIntContainer) Set(dest, x BigIntHandle) BigIntHandle

Set sets dest = x. It performs a copy of the data.

func (*BigIntContainer) SetBytes added in v0.0.3

func (c *BigIntContainer) SetBytes(dest BigIntHandle, buf []byte) BigIntHandle

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

func (*BigIntContainer) SetInt64 added in v0.0.3

func (c *BigIntContainer) SetInt64(dest BigIntHandle, value int64) BigIntHandle

SetInt64 sets value to dest.

func (*BigIntContainer) Sqrt added in v0.0.3

func (c *BigIntContainer) Sqrt(dest, x BigIntHandle) BigIntHandle

Sqrt sets dest to ⌊√x⌋, the largest integer such that z² ≤ x. It panics if x is negative.

func (*BigIntContainer) Sub

func (c *BigIntContainer) Sub(dest, x, y BigIntHandle) BigIntHandle

Sub sets dest to the difference x-y.

func (*BigIntContainer) ToInt64 added in v0.0.3

func (c *BigIntContainer) ToInt64(x BigIntHandle) int64

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

func (*BigIntContainer) Update added in v0.0.3

func (c *BigIntContainer) Update(dest BigIntHandle, newValue *big.Int) BigIntHandle

Update replaces contents at dest with value of given argument.

func (*BigIntContainer) Xor added in v0.0.3

func (c *BigIntContainer) Xor(dest, x, y BigIntHandle) BigIntHandle

Xor sets dest = x ^ y.

type BigIntHandle

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

BigIntHandle acts like a pointer to a big.Int value in a BigIntContainer.

Jump to

Keyboard shortcuts

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