gm3p/include/gm3p_int.hpp

39 lines
845 B
C++
Raw Normal View History

2020-07-18 21:06:17 +02:00
#pragma once
#include <iostream>
2020-07-18 21:06:17 +02:00
#include "gmp.h"
namespace gm3p
{
class gInt
{
public:
// CONSTRUCTORS
2020-07-18 21:06:17 +02:00
gInt();
gInt(mpz_t init);
gInt(unsigned long int init);
2020-07-18 21:06:17 +02:00
gInt(long int init);
gInt(const char* init, int base);
~gInt();
// ASSIGNMENT OPERATORS
2020-07-18 21:06:17 +02:00
gInt& operator=(const gInt& other);
// 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);
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;
};
}