This commit is contained in:
2024-05-11 19:44:32 +02:00
parent 0d071b1cf9
commit 2975006972
10 changed files with 201 additions and 32 deletions

49
include/BigInt.h Normal file
View File

@@ -0,0 +1,49 @@
#pragma once
#include <string>
#include <gmp.h>
/**
* \class BigInt
* \brief Représente un entier d'une taille quelconque
* \warning Prend énormément de place en mémoire. À utiliser avec précaution !
*/
class BigInt {
private:
mpz_t m_Data;
public:
BigInt(std::string&& a_Number);
BigInt(long a_Number = 0);
BigInt(const BigInt& a_Copy);
BigInt(BigInt&& a_Move);
~BigInt();
BigInt operator+(const BigInt& a_Other);
BigInt operator-(const BigInt& a_Other);
BigInt operator*(const BigInt& a_Other);
BigInt operator/(const BigInt& a_Other);
BigInt operator+=(const BigInt& a_Other);
BigInt operator-=(const BigInt& a_Other);
BigInt operator*=(const BigInt& a_Other);
BigInt operator/=(const BigInt& a_Other);
bool operator==(const BigInt& a_Other);
void operator=(const BigInt& a_Other);
const std::string ToString() const;
bool IsEqualZero() const;
};