Skip to content

Commit 9e5d83d

Browse files
Merge branch 'master' of github.com:smithlabcode/smithlab_cpp
2 parents 38eb583 + 9a43bb9 commit 9e5d83d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
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*std::min(i, total))/total);
229+
prev = std::round(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, '=');

smithlab_utils.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,21 +424,21 @@ inline kmer_counts(const std::vector<std::string> &seqs,
424424
class ProgressBar {
425425
public:
426426
ProgressBar(const size_t x, const std::string message = "completion") :
427-
total(x), prev(0), mid_tag(message) {
427+
total(x/100.0), prev(0), mid_tag(message) {
428428
bar_width = max_bar_width - message.length() - 3 - 5;
429429
bar = std::string(bar_width, ' ');
430430
}
431431
bool time_to_report(const size_t i) const {
432-
return std::round((100.0*std::min(i, total))/total) > prev;
432+
return std::round(std::min(i, total)/total) > prev;
433433
}
434434
void
435435
report(std::ostream &out, const size_t i);
436436

437437
private:
438438

439-
size_t total;
440-
size_t prev;
441-
size_t bar_width;
439+
size_t total{};
440+
size_t prev{};
441+
size_t bar_width{};
442442
std::string left_tag = "\r[";
443443
std::string mid_tag;
444444
std::string bar;

0 commit comments

Comments
 (0)