Documentation ¶
Index ¶
- Variables
- type BigIntContainer
- func (c *BigIntContainer) Abs(dest, x BigIntHandle) BigIntHandle
- func (c *BigIntContainer) Add(dest, x, y BigIntHandle) BigIntHandle
- func (c *BigIntContainer) And(dest, x, y BigIntHandle) BigIntHandle
- func (c *BigIntContainer) AndNot(dest, x, y BigIntHandle) BigIntHandle
- func (c *BigIntContainer) BitLen(x BigIntHandle) int
- func (c *BigIntContainer) ByteLen(x BigIntHandle) int
- func (c *BigIntContainer) Cmp(x, y BigIntHandle) int
- func (c *BigIntContainer) CmpAbs(x, y BigIntHandle) int
- func (c *BigIntContainer) Div(dest, x, y BigIntHandle) BigIntHandle
- func (c *BigIntContainer) Get(handler BigIntHandle) *big.Int
- func (c *BigIntContainer) GetBytes(x BigIntHandle) []byte
- func (c *BigIntContainer) GetUnsafe(handler BigIntHandle) *big.Int
- func (c *BigIntContainer) Insert(bi *big.Int) BigIntHandle
- func (c *BigIntContainer) InsertUint64(x uint64) BigIntHandle
- func (c *BigIntContainer) IsInt64(x BigIntHandle) bool
- func (c *BigIntContainer) Mod(dest, x, y BigIntHandle) BigIntHandle
- func (c *BigIntContainer) Mul(dest, x, y BigIntHandle) BigIntHandle
- func (c *BigIntContainer) Neg(dest, x BigIntHandle) BigIntHandle
- func (c *BigIntContainer) Not(dest, x BigIntHandle) BigIntHandle
- func (c *BigIntContainer) Or(dest, x, y BigIntHandle) BigIntHandle
- func (c *BigIntContainer) Quo(dest, x, y BigIntHandle) BigIntHandle
- func (c *BigIntContainer) Rem(dest, x, y BigIntHandle) BigIntHandle
- func (c *BigIntContainer) Set(dest, x BigIntHandle) BigIntHandle
- func (c *BigIntContainer) SetBytes(dest BigIntHandle, buf []byte) BigIntHandle
- func (c *BigIntContainer) SetInt64(dest BigIntHandle, value int64) BigIntHandle
- func (c *BigIntContainer) Sqrt(dest, x BigIntHandle) BigIntHandle
- func (c *BigIntContainer) Sub(dest, x, y BigIntHandle) BigIntHandle
- func (c *BigIntContainer) ToInt64(x BigIntHandle) int64
- func (c *BigIntContainer) Update(dest BigIntHandle, newValue *big.Int) BigIntHandle
- func (c *BigIntContainer) Xor(dest, x, y BigIntHandle) BigIntHandle
- type BigIntHandle
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
func (c *BigIntContainer) And(dest, x, y BigIntHandle) BigIntHandle
And sets dest = x & y.
func (*BigIntContainer) AndNot ¶
func (c *BigIntContainer) AndNot(dest, x, y BigIntHandle) BigIntHandle
AndNot sets dest = x &^ y.
func (*BigIntContainer) BitLen ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
func (c *BigIntContainer) IsInt64(x BigIntHandle) bool
IsInt64 reports whether x can be represented as an int64.
func (*BigIntContainer) Mod ¶
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 ¶
func (c *BigIntContainer) Neg(dest, x BigIntHandle) BigIntHandle
Neg sets dest to -x.
func (*BigIntContainer) Not ¶
func (c *BigIntContainer) Not(dest, x BigIntHandle) BigIntHandle
Not sets dest = ^x.
func (*BigIntContainer) Or ¶
func (c *BigIntContainer) Or(dest, x, y BigIntHandle) BigIntHandle
Or sets dest = x | y.
func (*BigIntContainer) Quo ¶
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 ¶
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 ¶
func (c *BigIntContainer) Set(dest, x BigIntHandle) BigIntHandle
Set sets dest = x. It performs a copy of the data.
func (*BigIntContainer) SetBytes ¶
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 ¶
func (c *BigIntContainer) SetInt64(dest BigIntHandle, value int64) BigIntHandle
SetInt64 sets value to dest.
func (*BigIntContainer) Sqrt ¶
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 ¶
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 ¶
func (c *BigIntContainer) Update(dest BigIntHandle, newValue *big.Int) BigIntHandle
Update replaces contents at dest with value of given argument.
func (*BigIntContainer) Xor ¶
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.