[6ba162] | 1 | // BigInt.h |
---|
| 2 | |
---|
[fea494] | 3 | // A BigInt-class with not much more functions than needed by the |
---|
[6ba162] | 4 | // LLL-algorithm. Wrapper class for the GNU MP library. |
---|
| 5 | |
---|
| 6 | #ifndef BIG_INT_H |
---|
| 7 | #define BIG_INT_H |
---|
| 8 | |
---|
| 9 | #include <stdlib.h> |
---|
| 10 | #include <float.h> |
---|
| 11 | #include <math.h> |
---|
| 12 | #include <ctype.h> |
---|
| 13 | #include <string.h> |
---|
[a1da6f] | 14 | #include <stddef.h> |
---|
[76f3a18] | 15 | #include <gmp.h> |
---|
[6ba162] | 16 | |
---|
| 17 | class BigInt |
---|
| 18 | { |
---|
| 19 | mpz_t value; |
---|
| 20 | |
---|
| 21 | public: |
---|
| 22 | |
---|
| 23 | BigInt( ); |
---|
| 24 | BigInt( int ); |
---|
| 25 | BigInt( const BigInt& ); |
---|
| 26 | ~BigInt( ); |
---|
| 27 | |
---|
| 28 | BigInt& operator = ( int ); |
---|
| 29 | BigInt& operator = ( const BigInt& ); |
---|
| 30 | |
---|
| 31 | operator bool( ); |
---|
| 32 | operator int( ); |
---|
[5f6e18] | 33 | operator short( ); |
---|
[6ba162] | 34 | |
---|
| 35 | BigInt operator - ( ); |
---|
| 36 | BigInt& operator += ( const BigInt& ); |
---|
| 37 | BigInt& operator -= ( const BigInt& ); |
---|
| 38 | BigInt& operator *= ( const BigInt& ); |
---|
| 39 | BigInt& operator /= ( const BigInt& ); |
---|
| 40 | BigInt& operator ++ ( ); |
---|
| 41 | BigInt operator ++ ( int ); |
---|
| 42 | BigInt& operator -- ( ); |
---|
| 43 | BigInt operator -- ( int ); |
---|
| 44 | |
---|
| 45 | friend BigInt operator - ( const BigInt& ); |
---|
[fea494] | 46 | |
---|
[6ba162] | 47 | friend bool operator < ( const BigInt&, const BigInt& ); |
---|
| 48 | friend bool operator <= ( const BigInt&, const BigInt& ); |
---|
| 49 | friend bool operator > ( const BigInt&, const BigInt& ); |
---|
| 50 | friend bool operator >= ( const BigInt&, const BigInt& ); |
---|
| 51 | friend bool operator == ( const BigInt&, const BigInt& ); |
---|
| 52 | friend bool operator != ( const BigInt&, const BigInt& ); |
---|
[5f6e18] | 53 | friend bool operator < ( const int&, const BigInt& ); |
---|
| 54 | friend bool operator <= ( const int&, const BigInt& ); |
---|
| 55 | friend bool operator > ( const int&, const BigInt& ); |
---|
| 56 | friend bool operator >= ( const int&, const BigInt& ); |
---|
| 57 | friend bool operator == ( const int&, const BigInt& ); |
---|
| 58 | friend bool operator != ( const int&, const BigInt& ); |
---|
| 59 | friend bool operator < ( const BigInt&, const int& ); |
---|
| 60 | friend bool operator <= ( const BigInt&, const int& ); |
---|
| 61 | friend bool operator > ( const BigInt&, const int& ); |
---|
| 62 | friend bool operator >= ( const BigInt&, const int& ); |
---|
| 63 | friend bool operator == ( const BigInt&, const int& ); |
---|
| 64 | friend bool operator != ( const BigInt&, const int& ); |
---|
[fea494] | 65 | |
---|
[6ba162] | 66 | friend int sgn ( const BigInt& ); |
---|
| 67 | friend BigInt abs ( const BigInt& ); |
---|
| 68 | }; |
---|
| 69 | |
---|
| 70 | BigInt operator + ( const BigInt&, const BigInt& ); |
---|
| 71 | BigInt operator - ( const BigInt&, const BigInt& ); |
---|
| 72 | BigInt operator * ( const BigInt&, const BigInt& ); |
---|
| 73 | BigInt operator / ( const BigInt&, const BigInt& ); |
---|
[5f6e18] | 74 | BigInt operator + ( const int&, const BigInt& ); |
---|
| 75 | BigInt operator - ( const int&, const BigInt& ); |
---|
| 76 | BigInt operator * ( const int&, const BigInt& ); |
---|
| 77 | BigInt operator / ( const int&, const BigInt& ); |
---|
| 78 | BigInt operator + ( const BigInt&, const int& ); |
---|
| 79 | BigInt operator - ( const BigInt&, const int& ); |
---|
| 80 | BigInt operator * ( const BigInt&, const int& ); |
---|
| 81 | BigInt operator / ( const BigInt&, const int& ); |
---|
[6ba162] | 82 | |
---|
| 83 | #endif // BIG_INT_H |
---|