diff options
author | tomsmeding <tom.smeding@gmail.com> | 2016-10-04 23:14:56 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2016-10-04 23:14:56 +0200 |
commit | 0b7499f8775e728c4a349933a95fe450c082a338 (patch) | |
tree | b5fe4652be8f2ed612f2dbdc66e2fae60049c9bf /bigint.cpp | |
parent | 550ff72727a1829bb72f5c40cffb96f2225fae84 (diff) |
Add (non-working yet) Lucas test
Diffstat (limited to 'bigint.cpp')
-rw-r--r-- | bigint.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -133,8 +133,9 @@ Bigint& Bigint::operator=(slongdigit_t v){ } Bigint& Bigint::operator+=(const Bigint &o){ - if(&o==this){ - return *this=Bigint(*this)+=o; + if(&o==this){ //*this + *this + operator<<=(1); + return *this; } if(sign==1){ if(o.sign==1)add(*this,o); @@ -148,8 +149,10 @@ Bigint& Bigint::operator+=(const Bigint &o){ } Bigint& Bigint::operator-=(const Bigint &o){ - if(&o==this){ - return *this=Bigint(*this)-=o; + if(&o==this){ // *this - *this + sign=1; + digits.clear(); + return *this; } if(sign==1){ if(o.sign==1)subtract(*this,o); |