Skip to content

Commit

Permalink
revert type declaration for overflow bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Herts committed Sep 16, 2024
1 parent f76f59a commit e72bf03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bigint.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ namespace BigInt {
std::transform(lhs.vec.rbegin(), lhs.vec.rend(), full_rhs.vec.rbegin(), carry_result.rbegin(), add_with_carry);

std::vector<long long> final(lhs.vec.size() + 1);
for (auto i = carry_result.size() - 1; i >= 0; --i) {
for (int i = carry_result.size() - 1; i >= 0; --i) {
final[i] += carry_result[i].second;
final[i - 1] += carry_result[i].first;
}
Expand Down Expand Up @@ -552,7 +552,7 @@ namespace BigInt {
subtract_with_borrow);

std::vector<long long> final(lhs.vec.size());
for (auto i = borrow_result.size() - 1; i >= 0; --i) {
for (int i = borrow_result.size() - 1; i >= 0; --i) {
final[i] += borrow_result[i].second;
if (borrow_result[i].first)
final[i - 1] -= borrow_result[i].first;
Expand Down

0 comments on commit e72bf03

Please sign in to comment.