From 19b3b8a866b5141e2aa3a3cb2352f6e7cb7258df Mon Sep 17 00:00:00 2001
From: Olivier Coulaud <olivier.coulaud@inria.fr>
Date: Fri, 31 Jan 2025 14:27:21 +0100
Subject: [PATCH] Setting the wrong max_level following a debugging session

---
 include/scalfmm/utils/sort.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/scalfmm/utils/sort.hpp b/include/scalfmm/utils/sort.hpp
index d563a0bf..0d9fba59 100644
--- a/include/scalfmm/utils/sort.hpp
+++ b/include/scalfmm/utils/sort.hpp
@@ -264,7 +264,7 @@ namespace scalfmm::utils
         std::copy(array.begin(), array.end(), tmp_array);
         constexpr static const std::size_t dimension = points_type::dimension;
         //
-        const std::size_t max_level = 2;   //sizeof(morton_type) * 8 / dimension - 1;
+        const std::size_t max_level = sizeof(morton_type) * 8 / dimension - 1;
         using pair_type = std::pair<morton_type, int>;
         std::vector<pair_type> tosort(nbParticles);
 #pragma omp parallel for shared(tosort, nbParticles, box, max_level, array)
@@ -275,7 +275,7 @@ namespace scalfmm::utils
             tosort[i].second = i;
         }
 
-        std::sort(tosort.begin(), tosort.end(), [&](pair_type& a, pair_type& b) { return (a.first > b.first); });
+        std::sort(tosort.begin(), tosort.end(), [&](pair_type& a, pair_type& b) { return (a.first < b.first); });
 
         //
         // We fill the sorted array
-- 
GitLab