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 <si_gmp.h> |
---|
15 | |
---|
16 | class BigInt |
---|
17 | { |
---|
18 | mpz_t value; |
---|
19 | |
---|
20 | public: |
---|
21 | |
---|
22 | BigInt( ); |
---|
23 | BigInt( long int ); |
---|
24 | BigInt( unsigned long int ); |
---|
25 | BigInt( int ); |
---|
26 | BigInt( unsigned int ); |
---|
27 | BigInt( short int ); |
---|
28 | BigInt( unsigned short int ); |
---|
29 | BigInt( char ); |
---|
30 | BigInt( unsigned char ); |
---|
31 | BigInt( const BigInt& ); |
---|
32 | ~BigInt( ); |
---|
33 | |
---|
34 | BigInt& operator = ( long int ); |
---|
35 | BigInt& operator = ( unsigned long int ); |
---|
36 | BigInt& operator = ( int ); |
---|
37 | BigInt& operator = ( unsigned int ); |
---|
38 | BigInt& operator = ( short int ); |
---|
39 | BigInt& operator = ( unsigned short int ); |
---|
40 | BigInt& operator = ( char ); |
---|
41 | BigInt& operator = ( unsigned char ); |
---|
42 | BigInt& operator = ( const BigInt& ); |
---|
43 | |
---|
44 | operator bool( ); |
---|
45 | operator long int( ); |
---|
46 | operator unsigned long int( ); |
---|
47 | operator int( ); |
---|
48 | operator unsigned int( ); |
---|
49 | operator short int( ); |
---|
50 | operator unsigned short int( ); |
---|
51 | operator char( ); |
---|
52 | operator unsigned char( ); |
---|
53 | |
---|
54 | BigInt operator - ( ); |
---|
55 | BigInt& operator += ( const BigInt& ); |
---|
56 | BigInt& operator -= ( const BigInt& ); |
---|
57 | BigInt& operator *= ( const BigInt& ); |
---|
58 | BigInt& operator /= ( const BigInt& ); |
---|
59 | BigInt& operator ++ ( ); |
---|
60 | BigInt operator ++ ( int ); |
---|
61 | BigInt& operator -- ( ); |
---|
62 | BigInt operator -- ( int ); |
---|
63 | |
---|
64 | friend BigInt operator - ( const BigInt& ); |
---|
65 | |
---|
66 | friend bool operator < ( const BigInt&, const BigInt& ); |
---|
67 | friend bool operator <= ( const BigInt&, const BigInt& ); |
---|
68 | friend bool operator > ( const BigInt&, const BigInt& ); |
---|
69 | friend bool operator >= ( const BigInt&, const BigInt& ); |
---|
70 | friend bool operator == ( const BigInt&, const BigInt& ); |
---|
71 | friend bool operator != ( const BigInt&, const BigInt& ); |
---|
72 | friend bool operator < ( const long int&, const BigInt& ); |
---|
73 | friend bool operator <= ( const long int&, const BigInt& ); |
---|
74 | friend bool operator > ( const long int&, const BigInt& ); |
---|
75 | friend bool operator >= ( const long int&, const BigInt& ); |
---|
76 | friend bool operator == ( const long int&, const BigInt& ); |
---|
77 | friend bool operator != ( const long int&, const BigInt& ); |
---|
78 | friend bool operator < ( const BigInt&, const long int& ); |
---|
79 | friend bool operator <= ( const BigInt&, const long int& ); |
---|
80 | friend bool operator > ( const BigInt&, const long int& ); |
---|
81 | friend bool operator >= ( const BigInt&, const long int& ); |
---|
82 | friend bool operator == ( const BigInt&, const long int& ); |
---|
83 | friend bool operator != ( const BigInt&, const long int& ); |
---|
84 | |
---|
85 | friend int sgn ( const BigInt& ); |
---|
86 | friend BigInt abs ( const BigInt& ); |
---|
87 | }; |
---|
88 | |
---|
89 | BigInt operator + ( const BigInt&, const BigInt& ); |
---|
90 | BigInt operator - ( const BigInt&, const BigInt& ); |
---|
91 | BigInt operator * ( const BigInt&, const BigInt& ); |
---|
92 | BigInt operator / ( const BigInt&, const BigInt& ); |
---|
93 | BigInt operator + ( const long int&, const BigInt& ); |
---|
94 | BigInt operator - ( const long int&, const BigInt& ); |
---|
95 | BigInt operator * ( const long int&, const BigInt& ); |
---|
96 | BigInt operator / ( const long int&, const BigInt& ); |
---|
97 | BigInt operator + ( const BigInt&, const long int& ); |
---|
98 | BigInt operator - ( const BigInt&, const long int& ); |
---|
99 | BigInt operator * ( const BigInt&, const long int& ); |
---|
100 | BigInt operator / ( const BigInt&, const long int& ); |
---|
101 | |
---|
102 | #endif // BIG_INT_H |
---|