source: git/IntegerProgramming/BigInt.h @ 1c4822a

spielwiese
Last change on this file since 1c4822a was a1da6f, checked in by Mohamed Barakat <mohamed.barakat@…>, 12 years ago
clang fixes Conflicts: IntegerProgramming/BigInt.h IntegerProgramming/gen_test.cc
  • Property mode set to 100644
File size: 2.7 KB
Line 
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
17class 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
70BigInt operator + ( const BigInt&, const BigInt& );
71BigInt operator - ( const BigInt&, const BigInt& );
72BigInt operator * ( const BigInt&, const BigInt& );
73BigInt operator / ( const BigInt&, const BigInt& );
74BigInt operator + ( const int&, const BigInt& );
75BigInt operator - ( const int&, const BigInt& );
76BigInt operator * ( const int&, const BigInt& );
77BigInt operator / ( const int&, const BigInt& );
78BigInt operator + ( const BigInt&, const int& );
79BigInt operator - ( const BigInt&, const int& );
80BigInt operator * ( const BigInt&, const int& );
81BigInt operator / ( const BigInt&, const int& );
82
83#endif  // BIG_INT_H
Note: See TracBrowser for help on using the repository browser.