From 3dfe1b8807bba9acc8cf4ed1b9ab63622497b7be Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 7 Apr 2019 12:13:45 +0200 Subject: [PATCH] classify: Modernize function UniformDensity This should fix an issue reported by Codacy. Signed-off-by: Stefan Weil --- src/classify/cluster.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/classify/cluster.cpp b/src/classify/cluster.cpp index d8f534e5ac..29898c0dc9 100644 --- a/src/classify/cluster.cpp +++ b/src/classify/cluster.cpp @@ -1829,12 +1829,13 @@ static double NormalDensity(int32_t x) { * @return The value of the uniform distribution at x. */ static double UniformDensity(int32_t x) { - static double UniformDistributionDensity = 1.0 / BUCKETTABLESIZE; + constexpr auto UniformDistributionDensity = 1.0 / BUCKETTABLESIZE; - if ((x >= 0.0) && (x <= BUCKETTABLESIZE)) + if ((x >= 0) && (x <= BUCKETTABLESIZE)) { return UniformDistributionDensity; - else + } else { return 0.0; + } } // UniformDensity /**