Skip to content

Commit

Permalink
Fix overflow in progress report (Chia-Network#279)
Browse files Browse the repository at this point in the history
In phase4, the numerator `n` and denominator `max_n` reported via progress are larger than 2^31, causing the printed progress to be incorrect.
This change fixes that overflow.
  • Loading branch information
mgraczyk authored Jun 11, 2021
1 parent b90dca4 commit aaa0007
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/progress.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <iostream>

void progress(int phase, int n, int max_n) {
void progress(int phase, int64_t n, int64_t max_n) {
float p = (100.0 / 4) * ((phase - 1.0) + (1.0 * n / max_n));
std::cout << "Progress: " << p << std::endl;
}
Expand Down

0 comments on commit aaa0007

Please sign in to comment.