1 | // BigInt.h |
---|
2 | |
---|
3 | // A BigInt-class with not much more functions than needed by the |
---|
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> |
---|
14 | #include <stddef.h> |
---|
15 | #include <gmp.h> |
---|
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( ); |
---|
33 | operator short( ); |
---|
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& ); |
---|
46 | |
---|
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& ); |
---|
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& ); |
---|
65 | |
---|
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& ); |
---|
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& ); |
---|
82 | |
---|
83 | #endif // BIG_INT_H |
---|