-
Notifications
You must be signed in to change notification settings - Fork 0
/
integer.h
93 lines (68 loc) · 2.25 KB
/
integer.h
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
84
85
86
87
88
89
90
91
92
93
/** @cond ADS_INTERNAL */
#ifndef ADSIMPROVEDINTEGER_H
#define ADSIMPROVEDINTEGER_H
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <cmath>
#include <conio.h>
#include<iostream>
typedef int8_t byte;
using namespace std;
#define PackedBCDMSB RightNibble
#define PackedBCDLSB LeftNibble
class Integer {
protected :
byte * data;
short int sign;
short int blocksize;
int altonum(char ch);
void init(const byte * num, int blocksize, int sign);
Integer prepareSub() const ;
static int strip(byte * tmp,int size,int sign);
public :
Integer() : data(NULL), sign(0) , blocksize(0) {};
Integer(const char * );
Integer(int n);
Integer(const Integer& i);
Integer NinesCompliment() const ;
Integer TensCompliment() const ;
~Integer();
Integer abs();
int compare(const Integer& n) const ;
bool operator<(const Integer& n) const ;
bool operator<(const int& n) const ;
friend bool operator<(const int& n,const Integer& i) ;
bool operator>(const Integer& n) const ;
bool operator>(const int& n) const ;
friend bool operator>(const int& n, const Integer& i) ;
bool operator==(const Integer& n) const ;
bool operator==(const int& n) const ;
friend bool operator==(const int& n,const Integer& i) ;
bool operator<=(const Integer& n) const ;
bool operator<=(const int& n) const ;
friend bool operator<=(const int& n,const Integer& i) ;
bool operator>=(const Integer& n) const ;
bool operator>=(const int& n) const ;
friend bool operator>=(const int& n,const Integer& i) ;
bool operator!=(const Integer& n) const ;
bool operator!=(const int& n) const ;
friend bool operator!=(const int& n,const Integer& i) ;
Integer operator++();
Integer operator++(int);
Integer operator+(const Integer& n);
Integer operator+(const int& n);
Integer operator-(const Integer& n);
Integer operator-(const int& n);
Integer operator*(const Integer& n);
Integer operator*(const int& n);
Integer operator/(const Integer& n);
Integer operator/(const int& n);
Integer operator%(const Integer& n);
Integer& operator=(const Integer& n);
Integer& operator=(const int& n);
friend ostream& operator<<(ostream& out,const Integer& i);
};
#endif
/** @endcond */