1 #ifndef TERRACES_BIGINT_HPP 2 #define TERRACES_BIGINT_HPP 3 4 #include "definitions.hpp" 5 6 #ifndef USE_GMP 7 #include "clamped_uint.hpp" 8 namespace terraces { 9 using big_integer = terraces::overflow_except_uint; 10 } 11 #else 12 #include <gmpxx.h> 13 #include <iosfwd> 14 namespace terraces { 15 class big_integer { 16 mpz_class m_value; 17 18 public: 19 big_integer(index i = 0); 20 big_integer& operator+=(const big_integer& other); 21 big_integer& operator*=(const big_integer& other); 22 bool is_clamped() const; 23 const mpz_class& value() const; 24 }; 25 bool operator==(const big_integer& a, const big_integer& b); 26 bool operator!=(const big_integer& a, const big_integer& b); 27 big_integer operator+(const big_integer& a, const big_integer& b); 28 big_integer operator*(const big_integer& a, const big_integer& b); 29 std::ostream& operator<<(std::ostream& stream, const big_integer& val); 30 } // namespace terraces 31 #endif 32 33 #endif // TERRACES_BIGINT_HPP 34