From 2dd7c95a111a930e8e23140ab3fec074e7de4c8c Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 29 May 2026 21:56:48 +0200 Subject: Dangling --- lib/core/c++/math/round.hpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/core/c++/math/round.hpp (limited to 'lib/core/c++/math/round.hpp') diff --git a/lib/core/c++/math/round.hpp b/lib/core/c++/math/round.hpp new file mode 100644 index 0000000..d3a2586 --- /dev/null +++ b/lib/core/c++/math/round.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include "../common.hpp" + +namespace kel { +namespace lbm { + +template +saw::data> round_to_unsigned(const saw::data>& inp){ + saw::data> rv; + + auto zero = static_cast::type>(0); + auto half = static_cast::type>(0.5); + + for(uint64_t i{0u}; i < D; ++i){ + auto val = inp.at({{i}}).get()+half; + val = std::max(zero,val); + + rv.at({i}).set(static_cast(val)); + } + + return rv; +} + +} +} -- cgit v1.2.3