go/misc/cgo/gmp/gmp.go

type Int

// NewInt returns a new Int initialized to x.
func NewInt(x int64) *Int {}

// Int promises that the zero value is a 0, but in gmp
// the zero value is a crash.  To bridge the gap, the
// init bool says whether this is a valid gmp value.
// doinit initializes z.i if it needs it.  This is not inherent
// to FFI, just a mismatch between Go's convention of
// making zero values useful and gmp's decision not to.
func (z *Int) doinit() {}

// Bytes returns z's representation as a big-endian byte array.
func (z *Int) Bytes() []byte {}

// Len returns the length of z in bits.  0 is considered to have length 1.
func (z *Int) Len() int {}

// Set sets z = x and returns z.
func (z *Int) Set(x *Int) *Int {}

// SetBytes interprets b as the bytes of a big-endian integer
// and sets z to that value.
func (z *Int) SetBytes(b []byte) *Int {}

// SetInt64 sets z = x and returns z.
func (z *Int) SetInt64(x int64) *Int {}

// SetString interprets s as a number in the given base
// and sets z to that value.  The base must be in the range [2,36].
// SetString returns an error if s cannot be parsed or the base is invalid.
func (z *Int) SetString(s string, base int) error {}

// String returns the decimal representation of z.
func (z *Int) String() string {}

func (z *Int) destroy() {}

// Add sets z = x + y and returns z.
func (z *Int) Add(x, y *Int) *Int {}

// Sub sets z = x - y and returns z.
func (z *Int) Sub(x, y *Int) *Int {}

// Mul sets z = x * y and returns z.
func (z *Int) Mul(x, y *Int) *Int {}

// Div sets z = x / y, rounding toward zero, and returns z.
func (z *Int) Div(x, y *Int) *Int {}

// Mod sets z = x % y and returns z.
// Like the result of the Go % operator, z has the same sign as x.
func (z *Int) Mod(x, y *Int) *Int {}

// Lsh sets z = x << s and returns z.
func (z *Int) Lsh(x *Int, s uint) *Int {}

// Rsh sets z = x >> s and returns z.
func (z *Int) Rsh(x *Int, s uint) *Int {}

// Exp sets z = x^y % m and returns z.
// If m == nil, Exp sets z = x^y.
func (z *Int) Exp(x, y, m *Int) *Int {}

func (z *Int) Int64() int64 {}

// Neg sets z = -x and returns z.
func (z *Int) Neg(x *Int) *Int {}

// Abs sets z to the absolute value of x and returns z.
func (z *Int) Abs(x *Int) *Int {}

// CmpInt compares x and y. The result is
//
//	-1 if x <  y
//	 0 if x == y
//	+1 if x >  y
func CmpInt(x, y *Int) int {}

// DivModInt sets q = x / y and r = x % y.
func DivModInt(q, r, x, y *Int) {}

// GcdInt sets d to the greatest common divisor of a and b,
// which must be positive numbers.
// If x and y are not nil, GcdInt sets x and y such that d = a*x + b*y.
// If either a or b is not positive, GcdInt sets d = x = y = 0.
func GcdInt(d, x, y, a, b *Int) {}

// ProbablyPrime performs n Miller-Rabin tests to check whether z is prime.
// If it returns true, z is prime with probability 1 - 1/4^n.
// If it returns false, z is not prime.
func (z *Int) ProbablyPrime(n int) bool {}