Documentation ¶
Index ¶
- func AddDelta(z, x *uint256.Int, y *Int)
- func AddDeltaOverflow(z, x *uint256.Int, y *Int) bool
- type Int
- func (z *Int) Abs() *uint256.Int
- func (z *Int) AbsGt(x *uint256.Int) bool
- func (z *Int) AbsLt(x *uint256.Int) bool
- func (z *Int) Add(x, y *Int) *Int
- func (z *Int) AddUint256(x *Int, y *uint256.Int) *Int
- func (z *Int) And(x, y *Int) *Int
- func (z *Int) Clone() *Int
- func (z *Int) Cmp(x *Int) (r int)
- func (z *Int) Div(x, y *Int) *Int
- func (z *Int) DivUint256(x *Int, y *uint256.Int) *Int
- func (z *Int) Eq(x *Int) bool
- func (z *Int) Exp(x, y, m *Int) *Int
- func (z *Int) Gt(x *Int) bool
- func (z *Int) Int64() int64
- func (z *Int) IsZero() bool
- func (z *Int) Lsh(x *Int, n uint) *Int
- func (z *Int) Lt(x *Int) bool
- func (z *Int) MarshalJSON() ([]byte, error)
- func (z *Int) Mod(x, y *Int) *Int
- func (z *Int) Mul(x, y *Int) *Int
- func (z *Int) MulUint256(x *Int, y *uint256.Int) *Int
- func (z *Int) Neg(x *Int) *Int
- func (z *Int) Or(x, y *Int) *Int
- func (z *Int) Quo(x, y *Int) *Int
- func (z *Int) Rem(x, y *Int) *Int
- func (z *Int) Rsh(x *Int, n uint) *Int
- func (z *Int) Set(x *Int) *Int
- func (z *Int) SetInt64(x int64) *Int
- func (z *Int) SetString(s string) (*Int, error)
- func (z *Int) SetUint256(x *uint256.Int) *Int
- func (z *Int) SetUint64(x uint64) *Int
- func (z *Int) Sign() int
- func (z *Int) Sqrt(x *Int) *Int
- func (z *Int) String() string
- func (z *Int) Sub(x, y *Int) *Int
- func (z *Int) SubUint256(x *Int, y *uint256.Int) *Int
- func (z *Int) ToBig() *big.Int
- func (z *Int) Uint64() uint64
- func (z *Int) UnmarshalJSON(input []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
func FromUint256 ¶
FromUint256 is a convenience-constructor from uint256.Int. Returns a new Int and whether overflow occurred. OBS: If u is `nil`, this method returns `nil, false`
func MustFromBig ¶
func (*Int) AddUint256 ¶
AddUint256 set z to the sum x + y, where y is a uint256, and returns z
func (*Int) DivUint256 ¶
DivUint256 sets z to the quotient x/y, where y is a uint256, and returns z If y == 0, z is set to 0
func (*Int) Exp ¶
Exp sets z = x**y mod |m| (i.e. the sign of m is ignored), and returns z. If m == nil or m == 0, z = x**y unless y <= 0 then z = 1. If m != 0, y < 0, and x and m are not relatively prime, z is unchanged and nil is returned.
Modular exponentiation of inputs of a particular size is not a cryptographically constant-time operation.
func (*Int) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Int) Mod ¶
Mod sets z to the modulus x%y for y != 0 and returns z. If y == 0, z is set to 0 (OBS: differs from the big.Int)
func (*Int) MulUint256 ¶
MulUint256 sets z to the product x*y, where y is a uint256, and returns z
func (*Int) Quo ¶
Quo sets z to the quotient x/y for y != 0 and returns z. If y == 0, a division-by-zero run-time panic occurs. Quo implements truncated division (like Go); see QuoRem for more details.
func (*Int) Rem ¶
Rem sets z to the remainder x%y for y != 0 and returns z. If y == 0, a division-by-zero run-time panic occurs. Rem implements truncated modulus (like Go); see QuoRem for more details.
func (*Int) SetUint256 ¶
SetFromUint256 converts a uint256.Int to Int and sets the value to z.
func (*Int) Sqrt ¶
Sqrt sets z to ⌊√x⌋, the largest integer such that z² ≤ x, and returns z. It panics if x is negative.
func (*Int) SubUint256 ¶
SubUint256 set z to the difference x - y, where y is a uint256, and returns z
func (*Int) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.