Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/bigint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Bigint &Bigint::operator-=(Bigint const &b)
++it2;
}
if (dif < 0) {
*(it1 - 1) = (dif * (-1)) % base;
*(it1 - 1) = dif + base;
dif = -1;
} else {
*(it1 - 1) = dif % base;
Expand All @@ -169,6 +169,16 @@ Bigint &Bigint::operator-=(Bigint const &b)
}
if (dif < 0) positive = false;

if (number.size() > 1)
Copy link
Owner

@kasparsklavins kasparsklavins Sep 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this better than a regular while loop? The same condition is called either way.

Created an unneeded indentation, imo.

{
do
{
it1 = number.end() - 1;
if (*it1 == 0) number.pop_back();
else break;
} while (number.size() > 1);
}

return *this;
}

Expand Down