upd: begin writing add

This commit is contained in:
2023-10-28 15:38:49 +08:00
parent f23620a931
commit d3606e22d1
5 changed files with 192 additions and 22 deletions

View File

@ -10,6 +10,11 @@
namespace sjtu {
class int2048 {
/**
* If the interger is negative, flag = -1, otherwise flag = 1.
* num_length is the length of the integer, (num_length+kNum-1)/kNum is the
* length of val with data. Note that position in val without data is 0.
*/
size_t buf_length = 0;
const static int kMod = 100000000, kNum = 8, kDefaultLength = 10;
const static int kMemAdditionScalar = 2, kMemDeleteScalar = 4;
@ -22,10 +27,16 @@ class int2048 {
int2048(long long);
int2048(const std::string &);
int2048(const int2048 &);
int2048 (int2048 &&) noexcept;
void read(const std::string &);
void print();
void ClaimMem(size_t);
inline friend int UnsignedCmp(const int2048 &A,const int2048 &B);
inline friend void UnsignedAdd(int2048 &,const int2048 *pB);
inline friend void UnsignedMinus(int2048 &,const int2048 *pB);
int2048 &add(const int2048 &);
friend int2048 add(int2048, const int2048 &);
@ -36,6 +47,7 @@ class int2048 {
int2048 operator-() const;
int2048 &operator=(const int2048 &);
int2048 &operator=(int2048 &&) noexcept;
int2048 &operator+=(const int2048 &);
friend int2048 operator+(int2048, const int2048 &);