00001
00002
00003
00004
00005
00006 #pragma once
00007
00009 class CLargeInteger
00010 {
00011 public:
00012
00013 CLargeInteger(unsigned short sizeInBytes);
00014 CLargeInteger(unsigned long initialValue, unsigned short sizeInBytes);
00015
00016 CLargeInteger(const CLargeInteger ©);
00017
00018
00019 ~CLargeInteger(void);
00020
00021
00022 const char* toString();
00023 const char* toHexString();
00024 const char* toBinString();
00025
00026
00027 unsigned short divideAndGiveCarry(unsigned short divisor);
00028 CLargeInteger pow(CLargeInteger &base, unsigned long exponent);
00029 void pow(unsigned long exponent);
00030 void setZero();
00031 void shiftLeftMax16(unsigned shift);
00032 void shiftRightMax16(unsigned shift);
00033
00034
00035
00036 public:
00037
00038
00039 bool operator == (const unsigned short number);
00040
00041 bool operator > (const CLargeInteger &compareLarger);
00042 bool operator < (const CLargeInteger &compareSmaller);
00043
00044 CLargeInteger& operator = (const CLargeInteger &assign);
00045 CLargeInteger& operator = (const unsigned long assign);
00046
00047 CLargeInteger operator + (const CLargeInteger &add);
00048 CLargeInteger operator + (const unsigned long add);
00049 CLargeInteger& operator += (const CLargeInteger &add);
00050 CLargeInteger& operator += (const unsigned long add);
00051 CLargeInteger& operator ++ (void);
00052
00053
00054
00055
00056
00057
00058 CLargeInteger operator * (const CLargeInteger &mul);
00059
00060 CLargeInteger& operator *= (const CLargeInteger &mul);
00061
00062
00063 CLargeInteger operator / (const CLargeInteger &div);
00064
00065
00066
00067
00068 CLargeInteger operator ^ (long exponent);
00069 CLargeInteger& operator ^= (long exponent);
00070
00071
00072
00073
00074 private:
00075 char negative;
00076 unsigned short *pNumber;
00077 unsigned short sizeShorts;
00078 char *pOutString;
00079 };