3 * @brief Wraps to GMP mpz_t type using inlines
15 Gmpint(int64_t i) {mpz_init_set_si(m_op, i);}
16 Gmpint(const std::string & str, int base=10) {mpz_init_set_str(m_op, str.c_str(), base);}
17 Gmpint(const Gmpint & cpy) {mpz_init(m_op); mpz_set(m_op, cpy.m_op);}
18 virtual ~Gmpint() {} //TODO: Do we need to delete m_op somehow?
21 operator int64_t() const {return mpz_get_si(m_op);}
22 operator uint64_t() const {return mpz_get_ui(m_op);}
23 operator double() const {return mpz_get_d(m_op);}
24 std::string Str(int base = 10) const
26 //TODO: Make less hacky, if we care.
27 char * buff = mpz_get_str(NULL, 10, m_op);
28 std::string result(buff);
33 Gmpint & operator=(const Gmpint & equ) {mpz_set(m_op, equ.m_op); return *this;}
34 Gmpint & operator+=(const Gmpint & add) {mpz_add(m_op, m_op, add.m_op); return *this;}
35 Gmpint & operator-=(const Gmpint & sub) {mpz_sub(m_op, m_op, sub.m_op); return *this;}
36 Gmpint & operator*=(const Gmpint & mul) {mpz_mul(m_op, m_op, mul.m_op); return *this;}
37 Gmpint & operator/=(const Gmpint & div) {mpz_div(m_op, m_op, div.m_op); return *this;}
39 Gmpint operator+(const Gmpint & add) const {Gmpint a(*this); a += add; return a;}
40 Gmpint operator-(const Gmpint & sub) const {Gmpint a(*this); a -= sub; return a;}
41 Gmpint operator*(const Gmpint & mul) const {Gmpint a(*this); a *= mul; return a;}
42 Gmpint operator/(const Gmpint & div) const {Gmpint a(*this); a /= div; return a;}
43 Gmpint operator%(const Gmpint & div) const {Gmpint a(*this); mpz_mod(a.m_op, a.m_op, div.m_op); return a;}
44 Gmpint operator-() const {return (Gmpint(0L)-*this);}
47 bool operator==(const Gmpint & cmp) const {return mpz_cmp(m_op, cmp.m_op) == 0;}
48 bool operator!=(const Gmpint & cmp) const {return mpz_cmp(m_op, cmp.m_op) != 0;}
49 bool operator<(const Gmpint & cmp) const {return mpz_cmp(m_op, cmp.m_op) < 0;}
50 bool operator>(const Gmpint & cmp) const {return mpz_cmp(m_op, cmp.m_op) > 0;}
51 bool operator<=(const Gmpint & cmp) const {return mpz_cmp(m_op, cmp.m_op) <= 0;}
52 bool operator>=(const Gmpint & cmp) const {return mpz_cmp(m_op, cmp.m_op) >= 0;}
54 Gmpint Abs() const {Gmpint a(*this); mpz_abs(a.m_op, a.m_op); return a;}