2020-07-18 21:06:17 +02:00
|
|
|
#pragma once
|
|
|
|
|
2020-07-18 22:47:00 +02:00
|
|
|
#include <iostream>
|
|
|
|
|
2020-07-18 21:06:17 +02:00
|
|
|
#include "gmp.h"
|
|
|
|
|
|
|
|
namespace gm3p
|
|
|
|
{
|
|
|
|
class gInt
|
|
|
|
{
|
|
|
|
public:
|
2020-07-18 22:47:00 +02:00
|
|
|
// CONSTRUCTORS
|
2020-07-18 21:06:17 +02:00
|
|
|
gInt();
|
|
|
|
gInt(mpz_t init);
|
2020-07-18 22:47:00 +02:00
|
|
|
gInt(unsigned long int init);
|
2020-07-18 21:06:17 +02:00
|
|
|
gInt(long int init);
|
|
|
|
gInt(const char* init, int base);
|
|
|
|
~gInt();
|
|
|
|
|
2020-07-18 22:47:00 +02:00
|
|
|
// ASSIGNMENT OPERATORS
|
2020-07-18 21:06:17 +02:00
|
|
|
gInt& operator=(const gInt& other);
|
|
|
|
|
2020-07-18 22:47:00 +02:00
|
|
|
// ARITHMETIC OPERATORS
|
2020-07-18 21:06:17 +02:00
|
|
|
friend gInt operator+(const gInt& left, const gInt& right);
|
|
|
|
friend gInt operator-(const gInt& left, const gInt& right);
|
|
|
|
friend gInt operator*(const gInt& left, const gInt& right);
|
|
|
|
friend gInt operator/(const gInt& left, const gInt& right);
|
|
|
|
|
2020-07-18 22:47:00 +02:00
|
|
|
gInt& operator+=(const gInt& right);
|
|
|
|
gInt& operator-=(const gInt& right);
|
|
|
|
gInt& operator*=(const gInt& right);
|
|
|
|
gInt& operator/=(const gInt& right);
|
|
|
|
|
2020-07-18 21:06:17 +02:00
|
|
|
friend std::ostream& operator<<(std::ostream& os, const gInt& value);
|
|
|
|
|
|
|
|
private:
|
|
|
|
mpz_t value;
|
|
|
|
};
|
|
|
|
}
|