abacus: bignum: fix order comparisons

This is a pretty big oversight...
This commit is contained in:
Bruno BELANYI 2021-08-21 12:48:37 +02:00
parent 5bc3963317
commit 3397bf4310
2 changed files with 12 additions and 0 deletions

View file

@ -16,6 +16,10 @@ namespace {
auto static constexpr BASE = 10;
bool do_less_than(digits_type const& lhs, digits_type const& rhs) {
if (lhs.size() != rhs.size()) {
return lhs.size() < rhs.size();
}
return std::lexicographical_compare(lhs.rbegin(), lhs.rend(), rhs.rbegin(),
rhs.rend());
}