summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGereon Kremer <gkremer@stanford.edu>2021-04-26 22:16:27 +0200
committerGitHub <noreply@github.com>2021-04-26 20:16:27 +0000
commite9362389e834d97ad2ef2a9c02d6c1fb57239524 (patch)
tree4f7249d1bb4f1ba3d2155233b5ae387cef756d3c
parentc32f952b1e496a5bd05552f676d51b5af3e49ed0 (diff)
Protect int stats methods (#6442)
This PR protects two methods of the IntStat class in case statistics are disabled.
-rw-r--r--src/util/statistics_stats.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/util/statistics_stats.cpp b/src/util/statistics_stats.cpp
index 971c592ac..1ecbf61ce 100644
--- a/src/util/statistics_stats.cpp
+++ b/src/util/statistics_stats.cpp
@@ -68,17 +68,23 @@ IntStat& IntStat::operator+=(int64_t val)
void IntStat::maxAssign(int64_t val)
{
- if (d_data->d_value < val)
+ if constexpr (Configuration::isStatisticsBuild())
{
- d_data->d_value = val;
+ if (d_data->d_value < val)
+ {
+ d_data->d_value = val;
+ }
}
}
void IntStat::minAssign(int64_t val)
{
- if (d_data->d_value > val)
+ if constexpr (Configuration::isStatisticsBuild())
{
- d_data->d_value = val;
+ if (d_data->d_value > val)
+ {
+ d_data->d_value = val;
+ }
}
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback