Skip to content

Commit

Permalink
Wrap all std::min and std::max calls in parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottHutchinson authored and horenmar committed Feb 20, 2021
1 parent 68975e3 commit b025a00
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion include/internal/benchmark/detail/catch_estimate_clock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ namespace Catch {
}
template <typename Clock>
EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_cost(FloatDuration<Clock> resolution) {
auto time_limit = std::min(resolution * clock_cost_estimation_tick_limit, FloatDuration<Clock>(clock_cost_estimation_time_limit));
auto time_limit = (std::min)(
resolution * clock_cost_estimation_tick_limit,
FloatDuration<Clock>(clock_cost_estimation_time_limit));
auto time_clock = [](int k) {
return Detail::measure<Clock>([k] {
for (int i = 0; i < k; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions include/internal/benchmark/detail/catch_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ namespace Catch {
double sb = stddev.point;
double mn = mean.point / n;
double mg_min = mn / 2.;
double sg = std::min(mg_min / 4., sb / std::sqrt(n));
double sg = (std::min)(mg_min / 4., sb / std::sqrt(n));
double sg2 = sg * sg;
double sb2 = sb * sb;

Expand All @@ -171,7 +171,7 @@ namespace Catch {
return (nc / n) * (sb2 - nc * sg2);
};

return std::min(var_out(1), var_out(std::min(c_max(0.), c_max(mg_min)))) / sb2;
return (std::min)(var_out(1), var_out((std::min)(c_max(0.), c_max(mg_min)))) / sb2;
}


Expand Down
4 changes: 2 additions & 2 deletions include/internal/benchmark/detail/catch_stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ namespace Catch {
double b2 = bias - z1;
double a1 = a(b1);
double a2 = a(b2);
auto lo = std::max(cumn(a1), 0);
auto hi = std::min(cumn(a2), n - 1);
auto lo = (std::max)(cumn(a1), 0);
auto hi = (std::min)(cumn(a2), n - 1);

return { point, resample[lo], resample[hi], confidence_level };
}
Expand Down

0 comments on commit b025a00

Please sign in to comment.