diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-05 15:59:23 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-05 15:59:23 +0200 |
| commit | c0549d71b2109f10c1238db8b22362e7826ba61b (patch) | |
| tree | 16cd5264fcc3afe912e1b1b67738c8940d6d1177 /modules/core/c++/index.hpp | |
| parent | 9a3147bc79caf3c0fb1a9cdee29d156b5ff092c7 (diff) | |
| download | libs-lbm-c0549d71b2109f10c1238db8b22362e7826ba61b.tar.gz | |
Just rename from lib to modules
Diffstat (limited to 'modules/core/c++/index.hpp')
| -rw-r--r-- | modules/core/c++/index.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/modules/core/c++/index.hpp b/modules/core/c++/index.hpp new file mode 100644 index 0000000..00e597e --- /dev/null +++ b/modules/core/c++/index.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "common.hpp" + +namespace kel { +namespace lbm { + +template<typename T, uint64_t D> +saw::data<sch::FixedArray<sch::UInt64,D>> lower_index_from_pos(const saw::data<sch::Vector<T,D>>& pos){ + saw::data<sch::FixedArray<sch::UInt64,D>> ind; + + for(saw::data<sch::UInt64> i{0u}; i < ind.size(); ++i){ + ind.at(i).set(std::max(pos.at(i).template cast_to<sch::UInt64>().get(),0)); + } + + return ind; +} + +template<typename T, uint64_t D> +saw::data<sch::FixedArray<sch::UInt64,D>> upper_index_from_pos(const saw::data<sch::Vector<T,D>>& pos){ + auto ind = lower_index_from_pos(pos); + + for(saw::data<sch::UInt64> i{0u}; i < ind.size(); ++i){ + ++ind.at(i); + } + return ind; +} + +} +} |
