Compare commits
No commits in common. "8cb26ee31611287cc32d8cf042bac47198e5c5f0" and "5c7c2af2896f9895962bd0cff4df99fd05125609" have entirely different histories.
8cb26ee316
...
5c7c2af289
|
@ -4,7 +4,7 @@ enable_testing()
|
|||
|
||||
add_library(common_options INTERFACE)
|
||||
target_compile_features(common_options INTERFACE
|
||||
cxx_std_20
|
||||
cxx_std_17
|
||||
)
|
||||
target_compile_options(common_options INTERFACE
|
||||
-Wall
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <span>
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
@ -83,17 +82,18 @@ digits_type do_addition(digits_type const& lhs, digits_type const& rhs) {
|
|||
++it2;
|
||||
}
|
||||
|
||||
auto leftover = [=]() {
|
||||
if (it1 != end1) {
|
||||
return std::span(it1, end1);
|
||||
auto it = it1;
|
||||
auto end = end1;
|
||||
if (it1 == end1) {
|
||||
it = it2;
|
||||
end = end2;
|
||||
}
|
||||
return std::span(it2, end2);
|
||||
}();
|
||||
|
||||
for (auto value : leftover) {
|
||||
int addition = value + carry;
|
||||
while (it != end) {
|
||||
int addition = *it + carry;
|
||||
carry = addition / BASE;
|
||||
res.push_back(addition % BASE);
|
||||
++it;
|
||||
}
|
||||
|
||||
if (carry != 0) {
|
||||
|
|
Loading…
Reference in a new issue