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)
|
add_library(common_options INTERFACE)
|
||||||
target_compile_features(common_options INTERFACE
|
target_compile_features(common_options INTERFACE
|
||||||
cxx_std_20
|
cxx_std_17
|
||||||
)
|
)
|
||||||
target_compile_options(common_options INTERFACE
|
target_compile_options(common_options INTERFACE
|
||||||
-Wall
|
-Wall
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <span>
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
@ -83,17 +82,18 @@ digits_type do_addition(digits_type const& lhs, digits_type const& rhs) {
|
||||||
++it2;
|
++it2;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto leftover = [=]() {
|
auto it = it1;
|
||||||
if (it1 != end1) {
|
auto end = end1;
|
||||||
return std::span(it1, end1);
|
if (it1 == end1) {
|
||||||
}
|
it = it2;
|
||||||
return std::span(it2, end2);
|
end = end2;
|
||||||
}();
|
}
|
||||||
|
|
||||||
for (auto value : leftover) {
|
while (it != end) {
|
||||||
int addition = value + carry;
|
int addition = *it + carry;
|
||||||
carry = addition / BASE;
|
carry = addition / BASE;
|
||||||
res.push_back(addition % BASE);
|
res.push_back(addition % BASE);
|
||||||
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (carry != 0) {
|
if (carry != 0) {
|
||||||
|
|
Loading…
Reference in a new issue