-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInteger.h
More file actions
40 lines (30 loc) · 784 Bytes
/
Integer.h
File metadata and controls
40 lines (30 loc) · 784 Bytes
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
#ifndef INTEGER_H
#define INTEGER_H
#include <iostream>
#include "String.h"
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long u64;
#define upper4(b) ((b >> 4) & 0x0F)
#define lower4(b) (b & 0x0F)
int highestbit(int n);
class Integer {
friend Integer operator+(const Integer &n1, const Integer &n2);
friend Integer operator-(const Integer &n1, const Integer &n2);
friend Integer operator*(const Integer &n1, const Integer &n2);
friend Integer operator%(const Integer &n1, const Integer &n2);
public:
Integer();
Integer(u32 n);
Integer(const char *);
Integer(const Integer &n);
const Integer& operator=(const Integer &n);
~Integer();
String toHexString();
String toString();
private:
u32 *m;
u32 len;
};
#endif