summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-11-16 00:59:53 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-11-16 00:59:53 +0100
commitbe5755b0b14973802094b8cd01ed7d0a01a987d6 (patch)
tree02f40cdd1015047c8601e7411fb1f5612651be54 /compat
parent2f10dd6ba6d02e0f1bf92d29cf3b5c92a079931b (diff)
src/chunk-walls: move computing wall parts to lookup table
Diffstat (limited to 'compat')
-rw-r--r--compat/unroll.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/compat/unroll.hpp b/compat/unroll.hpp
new file mode 100644
index 00000000..2b74ed1a
--- /dev/null
+++ b/compat/unroll.hpp
@@ -0,0 +1,13 @@
+#pragma once
+
+namespace floormat {
+
+template<uint32_t Max, typename F>
+constexpr CORRADE_ALWAYS_INLINE void unroll(F&& fn)
+{
+ [&]<size_t... Is>(std::index_sequence<Is...>) {
+ (..., fn(std::integral_constant<size_t, Is>{}));
+ }(std::make_index_sequence<Max>());
+}
+
+} // namespace floormat