// Finalizer - release the memory allocated to the mpz func _Int_finalize(z *Int) { if z.init { runtime.SetFinalizer(z, nil) C.mpz_clear(&z.i[0]) z.init = false } }
func (s *scalar) SetInt64(v int64) abstract.Scalar { vl := C.long(v) if int64(vl) != v { panic("Oops, int64 initializer doesn't fit into C.ulong") } var z C.mpz_t C.mpz_init(&z[0]) C.mpz_set_si(&z[0], vl) C.element_set_mpz(&s.e[0], &z[0]) C.mpz_clear(&z[0]) return s }
func (z *Int) destroy() { if z.init { C.mpz_clear(&z.i[0]) } z.init = false }
// Free the space occupied by the underlying gmp object. func (z *Int) Clear() { if z.init { C.mpz_clear(z.ptr) } z.init = false }