From f23bde11ec9e0ed1437ceae5493f815cf69c5814 Mon Sep 17 00:00:00 2001 From: Julian Stahl Date: Wed, 21 Sep 2022 01:12:15 +0200 Subject: [PATCH] Only compute dim once --- Isosurfacing_3/include/CGAL/Octree_wrapper.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Isosurfacing_3/include/CGAL/Octree_wrapper.h b/Isosurfacing_3/include/CGAL/Octree_wrapper.h index cab8dde6a5a..f81308b89b3 100644 --- a/Isosurfacing_3/include/CGAL/Octree_wrapper.h +++ b/Isosurfacing_3/include/CGAL/Octree_wrapper.h @@ -13,10 +13,10 @@ #ifndef CGAL_OCTREE_WRAPPER_H #define CGAL_OCTREE_WRAPPER_H -#include #include #include #include +#include namespace CGAL { namespace Isosurfacing { @@ -318,7 +318,8 @@ public: std::tuple ijk_index(const std::size_t& lex_index, const std::size_t& depth) const { - return std::make_tuple(i_index(lex_index, depth), j_index(lex_index, depth), k_index(lex_index, depth)); + const std::size_t dim = (std::size_t(1) << depth) + 1; + return std::make_tuple(lex_index % dim, (lex_index / dim) % dim, lex_index / (dim * dim)); } /// @@ -525,4 +526,4 @@ public: } // namespace Isosurfacing } // namespace CGAL -#endif // CGAL_OCTREE_WRAPPER_H +#endif // CGAL_OCTREE_WRAPPER_H