Skip to content

Commit 3ff4d2c

Browse files
Merge pull request #153 from smithlabcode/fixing-literal-suffix-incompat-on-macos
Fixing problem because of macOS
2 parents b97b671 + 52350a2 commit 3ff4d2c

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

src/analysis/bsrate.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,23 @@ struct bsrate_summary {
147147
void set_values() {
148148
bisulfite_conversion_rate_positive =
149149
static_cast<double>(converted_count_positive) /
150-
max(total_count_positive, 1ul);
150+
max(total_count_positive, static_cast<uint64_t>(1));
151151

152152
bisulfite_conversion_rate_negative =
153153
static_cast<double>(converted_count_negative) /
154-
max(total_count_negative, 1ul);
154+
max(total_count_negative, static_cast<uint64_t>(1));
155155

156156
converted_count = converted_count_positive + converted_count_negative;
157157
total_count = total_count_positive + total_count_negative;
158158

159159
bisulfite_conversion_rate =
160-
static_cast<double>(converted_count) / max(total_count, 1ul);
160+
static_cast<double>(converted_count) /
161+
max(total_count, static_cast<uint64_t>(1));
161162

162163
valid_count = total_count + error_count;
163164

164-
error_rate = static_cast<double>(error_count) / max(valid_count, 1ul);
165+
error_rate = static_cast<double>(error_count) /
166+
max(valid_count, static_cast<uint64_t>(1));
165167
}
166168

167169
string tostring_as_row() const {

src/analysis/hmr.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ struct hmr_summary {
5656
hmr_total_size = accumulate(cbegin(hmrs), cend(hmrs), 0,
5757
[](const uint64_t t, const GenomicRegion &p) {
5858
return t + p.get_width(); });
59-
hmr_mean_size =
60-
static_cast<double>(hmr_total_size)/std::max(1ul, hmr_count);
59+
hmr_mean_size =
60+
static_cast<double>(hmr_total_size)/
61+
std::max(hmr_count, static_cast<uint64_t>(1));
6162
}
6263
// hmr_count is the number of identified HMRs.
6364
uint64_t hmr_count{};
@@ -452,7 +453,7 @@ main_hmr(int argc, const char **argv) {
452453
opt_parse.add_opt("params-out", 'p', "write HMM parameters to this "
453454
"file (default: none)", false, params_out_file);
454455
opt_parse.add_opt("seed", 's', "specify random seed", false, rng_seed);
455-
opt_parse.add_opt("summary", 'S', "write summary output here", false,
456+
opt_parse.add_opt("summary", 'S', "write summary output here", false,
456457
summary_file);
457458
opt_parse.set_show_defaults();
458459
vector<string> leftover_args;

src/analysis/pmd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct pmd_summary {
6464
[](const uint64_t t, const GenomicRegion &p) {
6565
return t + p.get_width(); });
6666
pmd_mean_size =
67-
static_cast<double>(pmd_total_size)/std::max(1ul, pmd_count);
67+
static_cast<double>(pmd_total_size)/std::max(pmd_count, static_cast<uint64_t>(1));
6868
}
6969
// pmd_count is the number of identified PMDs.
7070
uint64_t pmd_count{};

src/common/LevelsCounter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LevelsCounter::update(const MSite &s) {
3131
}
3232
if (s.n_reads > 0) {
3333
++sites_covered;
34-
max_depth = std::max(max_depth, s.n_reads);
34+
max_depth = std::max(max_depth, static_cast<uint64_t>(s.n_reads));
3535
total_c += s.n_meth();
3636
total_t += s.n_reads - s.n_meth();
3737
total_meth += s.meth;

src/common/LevelsCounter.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,24 @@ struct LevelsCounter {
8181
// is the ratio of total_c divided by coverage. This value is always
8282
// between 0 and 1.
8383
double mean_meth_weighted() const {
84-
return static_cast<double>(total_c)/std::max(coverage(), 1ul);
84+
return static_cast<double>(total_c)/
85+
std::max(coverage(), static_cast<uint64_t>(1));
8586
}
8687

8788
// fractional_meth is the fraction of "called" sites that are called
8889
// methylated. It is the ratio of called_meth divided by
8990
// total_called. This value is always between 0 and 1.
9091
double fractional_meth() const {
91-
return static_cast<double>(called_meth)/std::max(total_called(), 1ul);
92+
return static_cast<double>(called_meth)/
93+
std::max(total_called(), static_cast<uint64_t>(1));
9294
}
9395

9496
// mean_meth is the unweighted mean methylation level. This is the
9597
// ratio of total_meth divided by sites_covered. This value is
9698
// always between 0 and 1.
9799
double mean_meth() const {
98-
return static_cast<double>(total_meth)/std::max(sites_covered, 1ul);
100+
return static_cast<double>(total_meth)/
101+
std::max(sites_covered, static_cast<uint64_t>(1));
99102
}
100103

101104
LevelsCounter(const std::string &c) : context{c} {}

0 commit comments

Comments
 (0)