summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-12-12 15:30:12 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-12-12 15:30:12 +0000
commit7ee8aee5add8d0c5b1a9e912a7043b2da4bb7453 (patch)
treef6e43da9e61c507bb774c488714d4a2bf1d58a9a /lib
parentglm::value_ptr is neater (diff)
downloadilt-7ee8aee5add8d0c5b1a9e912a7043b2da4bb7453.tar.bz2
ilt-7ee8aee5add8d0c5b1a9e912a7043b2da4bb7453.tar.xz
ilt-7ee8aee5add8d0c5b1a9e912a7043b2da4bb7453.zip
Move generic constexpr_strlen to lib
Diffstat (limited to 'lib')
-rw-r--r--lib/embed-glsl.cpp.m41
-rw-r--r--lib/strings.hpp14
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/embed-glsl.cpp.m4 b/lib/embed-glsl.cpp.m4
index 9e4c6d4..d820756 100644
--- a/lib/embed-glsl.cpp.m4
+++ b/lib/embed-glsl.cpp.m4
@@ -3,6 +3,7 @@ changecom()dnl
#include "substr(TYPE,1)-NAME.h"
#include <GL/glew.h>
#include "gfx/gl/shader-source.h"
+#include "lib/strings.hpp"
constexpr const GLchar * src { R"GLSL-EMBED(dnl
include(SOURCE))GLSL-EMBED" };
diff --git a/lib/strings.hpp b/lib/strings.hpp
new file mode 100644
index 0000000..ee0db95
--- /dev/null
+++ b/lib/strings.hpp
@@ -0,0 +1,14 @@
+#ifndef STRINGS_HPP
+#define STRINGS_HPP
+
+constexpr auto
+constexpr_strlen(const GLchar * const s)
+{
+ std::size_t ch {};
+ while (s[ch]) {
+ ch++;
+ }
+ return ch;
+}
+
+#endif