Skip to content

Commit 78abf3a

Browse files
Forcing progress bar to never show more than 100% progress
1 parent c198ca7 commit 78abf3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

smithlab_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ smithlab::squash(const std::vector<std::string>& v) {
226226

227227
void
228228
ProgressBar::report(std::ostream &out, const size_t i) {
229-
prev = std::round((100.0*i)/total);
229+
prev = std::round((100.0*std::min(i, total))/total);
230230
const size_t x =
231231
std::min(static_cast<size_t>(bar_width*(prev/100.0)), bar_width);
232232
fill_n(begin(bar), x, '=');

0 commit comments

Comments
 (0)