File: BigInt.h

package info (click to toggle)
singular 1%3A4.0.3-p3%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 33,040 kB
  • ctags: 19,347
  • sloc: cpp: 271,589; ansic: 13,500; lisp: 4,242; yacc: 1,656; lex: 1,377; makefile: 1,264; perl: 632; sh: 467; python: 233; xml: 182
file content (83 lines) | stat: -rw-r--r-- 2,738 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// BigInt.h

// A BigInt-class with not much more functions than needed by the
// LLL-algorithm. Wrapper class for the GNU MP library.

#ifndef BIG_INT_H
#define BIG_INT_H

#include <stdlib.h>
#include <float.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#include <stddef.h>
#include <gmp.h>

class BigInt
{
    mpz_t value;

    public:

    BigInt( );
    BigInt( int );
    BigInt( const BigInt& );
    ~BigInt( );

    BigInt& operator = ( int );
    BigInt& operator = ( const BigInt& );

    operator bool( );
    operator int( );
    operator short( );

    BigInt  operator - ( );
    BigInt& operator += ( const BigInt& );
    BigInt& operator -= ( const BigInt& );
    BigInt& operator *= ( const BigInt& );
    BigInt& operator /= ( const BigInt& );
    BigInt& operator ++ ( );
    BigInt  operator ++ ( int );
    BigInt& operator -- ( );
    BigInt  operator -- ( int );

    friend BigInt operator - ( const BigInt& );

    friend bool operator <  ( const BigInt&, const BigInt& );
    friend bool operator <= ( const BigInt&, const BigInt& );
    friend bool operator >  ( const BigInt&, const BigInt& );
    friend bool operator >= ( const BigInt&, const BigInt& );
    friend bool operator == ( const BigInt&, const BigInt& );
    friend bool operator != ( const BigInt&, const BigInt& );
    friend bool operator <  ( const int&, const BigInt& );
    friend bool operator <= ( const int&, const BigInt& );
    friend bool operator >  ( const int&, const BigInt& );
    friend bool operator >= ( const int&, const BigInt& );
    friend bool operator == ( const int&, const BigInt& );
    friend bool operator != ( const int&, const BigInt& );
    friend bool operator <  ( const BigInt&, const int& );
    friend bool operator <= ( const BigInt&, const int& );
    friend bool operator >  ( const BigInt&, const int& );
    friend bool operator >= ( const BigInt&, const int& );
    friend bool operator == ( const BigInt&, const int& );
    friend bool operator != ( const BigInt&, const int& );

    friend int    sgn ( const BigInt& );
    friend BigInt abs ( const BigInt& );
};

BigInt operator + ( const BigInt&, const BigInt& );
BigInt operator - ( const BigInt&, const BigInt& );
BigInt operator * ( const BigInt&, const BigInt& );
BigInt operator / ( const BigInt&, const BigInt& );
BigInt operator + ( const int&, const BigInt& );
BigInt operator - ( const int&, const BigInt& );
BigInt operator * ( const int&, const BigInt& );
BigInt operator / ( const int&, const BigInt& );
BigInt operator + ( const BigInt&, const int& );
BigInt operator - ( const BigInt&, const int& );
BigInt operator * ( const BigInt&, const int& );
BigInt operator / ( const BigInt&, const int& );

#endif  // BIG_INT_H