abacus: bignum: use base to compute complement
All checks were successful
ci/woodpecker/push/check Pipeline was successful
All checks were successful
ci/woodpecker/push/check Pipeline was successful
Instead of hard-coding 9 for base-10 computations.
This commit is contained in:
parent
8b3288c1ce
commit
2e29dea2b6
|
@ -107,7 +107,7 @@ digits_type do_substraction(digits_type const& lhs, digits_type const& rhs) {
|
|||
assert(!do_less_than(lhs, rhs));
|
||||
|
||||
digits_type complement;
|
||||
auto const take_complement = [](auto num) { return 9 - num; };
|
||||
auto const take_complement = [](auto num) { return BASE - 1 - num; };
|
||||
std::transform(lhs.begin(), lhs.end(), std::back_inserter(complement),
|
||||
take_complement);
|
||||
|
||||
|
|
Loading…
Reference in a new issue