From 25c84e1231aa66c15cac83cf42ea14e838374e4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com>
Date: Thu, 29 Jun 2023 10:17:12 +0200
Subject: [PATCH] Fix compilation (clang)

---
 src/utils/ReproductibleSumUtils.hpp | 12 ++++++------
 tests/test_Array.cpp                | 14 --------------
 2 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/src/utils/ReproductibleSumUtils.hpp b/src/utils/ReproductibleSumUtils.hpp
index 4b41980cc..bab97230e 100644
--- a/src/utils/ReproductibleSumUtils.hpp
+++ b/src/utils/ReproductibleSumUtils.hpp
@@ -68,7 +68,7 @@ ufp(const DataType& x) noexcept(NO_ASSERT)
 
 // Useful bits per bin
 template <typename DataType>
-constexpr inline size_t bin_size;
+constexpr inline size_t bin_size = 0;
 template <>
 constexpr inline size_t bin_size<double> = 40;
 template <>
@@ -76,15 +76,15 @@ constexpr inline size_t bin_size<float> = 12;
 
 // IEEE 754 epsilon
 template <typename DataType>
-constexpr inline double bin_epsilon;
+constexpr inline double bin_epsilon = 0;
 template <>
-constexpr inline double bin_epsilon<double> = std::pow(2., -53);
+constexpr inline double bin_epsilon<double> = 1.11022302462516e-16;   // std::pow(2., -53)
 template <>
-constexpr inline double bin_epsilon<float> = std::pow(2., -24);
+constexpr inline double bin_epsilon<float> = 5.96046447753906e-08;   // std::pow(2., -24)
 
 // number of bins: improves precision
 template <typename DataType>
-constexpr inline size_t bin_number;
+constexpr inline size_t bin_number = 0;
 
 template <>
 constexpr inline size_t bin_number<double> = 3;
@@ -93,7 +93,7 @@ constexpr inline size_t bin_number<float> = 4;
 
 // max local sum size to avoid overflow
 template <typename DataType>
-constexpr inline size_t bin_max_size;
+constexpr inline size_t bin_max_size = 0;
 
 template <>
 constexpr inline size_t bin_max_size<double> = 2048;
diff --git a/tests/test_Array.cpp b/tests/test_Array.cpp
index fb3a50ef9..ff12fa0af 100644
--- a/tests/test_Array.cpp
+++ b/tests/test_Array.cpp
@@ -357,22 +357,8 @@ TEST_CASE("Array", "[utils]")
 
     ReproductibleTinyVectorSum s0(array);
 
-    auto bin0 = s0.getSummationBin();
-    std::clog << "S0 = " << bin0.S[0] << ";" << bin0.S[1] << ";" << bin0.S[2] << " C0 = " << bin0.C[0] << ";"
-              << bin0.C[1] << ";" << bin0.C[2] << "\n";
     const auto sum_after_shuffle = sum(array);
 
-    ReproductibleTinyVectorSum s1(array);
-
-    auto bin1 = s1.getSummationBin();
-    std::clog << "S1 = " << bin1.S[0] << ";" << bin1.S[1] << ";" << bin1.S[2] << " C1 = " << bin1.C[0] << ";"
-              << bin1.C[1] << ";" << bin1.C[2] << "\n";
-
-    std::clog << "DIFF_BIN: DS = " << bin1.S[0] - bin0.S[0] << ";" << bin1.S[1] - bin0.S[1] << ";"
-              << bin1.S[1] - bin0.S[2] << '\n';
-
-    std::clog << "DIFF=" << sum_before_shuffle - sum_after_shuffle << '\n';
-
     REQUIRE(sum_before_shuffle == sum_after_shuffle);
   }
 
-- 
GitLab