aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/oaknut/impl/string_literal.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/oaknut/impl/string_literal.hpp')
-rw-r--r--include/oaknut/impl/string_literal.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/oaknut/impl/string_literal.hpp b/include/oaknut/impl/string_literal.hpp
index e09dfa65..412203e9 100644
--- a/include/oaknut/impl/string_literal.hpp
+++ b/include/oaknut/impl/string_literal.hpp
@@ -21,4 +21,22 @@ struct StringLiteral {
char value[N];
};
+namespace detail {
+
+template<StringLiteral<33> haystack, StringLiteral needles>
+consteval std::uint32_t find()
+{
+ std::uint32_t result = 0;
+ for (std::size_t i = 0; i < 32; i++) {
+ for (std::size_t a = 0; a < needles.strlen; a++) {
+ if (haystack.value[i] == needles.value[a]) {
+ result |= 1 << (31 - i);
+ }
+ }
+ }
+ return result;
+}
+
+} // namespace detail
+
} // namespace oaknut