X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Fparanoidnumber.cpp;h=efae86003e6ddefd36f5b071db370a6c78243b87;hb=35bc799125eec0d0c839af56fd136c8e85793a56;hp=40071e15f89f7585562cdf741e43e51c3b7c5b08;hpb=71df61ab8ea302247ad35ccdc973bc8e0cafd5b1;p=ipdf%2Fcode.git diff --git a/src/paranoidnumber.cpp b/src/paranoidnumber.cpp index 40071e1..efae860 100644 --- a/src/paranoidnumber.cpp +++ b/src/paranoidnumber.cpp @@ -432,14 +432,13 @@ ParanoidNumber * ParanoidNumber::OperationTerm(ParanoidNumber * b, Optype op, Pa #ifdef PARANOID_SIZE_LIMIT if (m_size >= PARANOID_SIZE_LIMIT) { + this->operator=(this->Digit()); if (op == ADD) - { - m_value += b->Digit() / GetFactors(); - } + m_value += b->Digit(); else - { - m_value -= b->Digit() / GetFactors(); - } + m_value -= b->Digit(); + m_size = 0; + Debug("Cut off %p", this); return b; } //Debug("At size limit %d", m_size); @@ -567,15 +566,14 @@ ParanoidNumber * ParanoidNumber::OperationFactor(ParanoidNumber * b, Optype op, #ifdef PARANOID_SIZE_LIMIT if (m_size >= PARANOID_SIZE_LIMIT) { + this->operator=(this->Digit()); if (op == MULTIPLY) m_value *= b->Digit(); else m_value /= b->Digit(); - - for (auto n : m_next[ADD]) - delete n->OperationFactor(new ParanoidNumber(*b), op); - for (auto n : m_next[SUBTRACT]) - delete n->OperationFactor(new ParanoidNumber(*b), op); + m_size = 0; + + Debug("Cut off %p", this); return b; }