From 1d4f28f02e28fb7de9b9273ca936640818b45c6e Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 15 Jan 2026 15:36:45 +0100 Subject: Trying to find a simple approach to handling the data --- lib/core/c++/index.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lib/core/c++/index.hpp (limited to 'lib/core/c++/index.hpp') diff --git a/lib/core/c++/index.hpp b/lib/core/c++/index.hpp new file mode 100644 index 0000000..00e597e --- /dev/null +++ b/lib/core/c++/index.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "common.hpp" + +namespace kel { +namespace lbm { + +template +saw::data> lower_index_from_pos(const saw::data>& pos){ + saw::data> ind; + + for(saw::data i{0u}; i < ind.size(); ++i){ + ind.at(i).set(std::max(pos.at(i).template cast_to().get(),0)); + } + + return ind; +} + +template +saw::data> upper_index_from_pos(const saw::data>& pos){ + auto ind = lower_index_from_pos(pos); + + for(saw::data i{0u}; i < ind.size(); ++i){ + ++ind.at(i); + } + return ind; +} + +} +} -- cgit v1.2.3