aboutsummaryrefslogtreecommitdiff
path: root/vendor/librune/lib/mbstring/u8rlen.c
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-02-13 13:02:28 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-02-13 13:11:47 +0100
commit79e6af86ca526d5fb56af6f6ca3da713e3a5e9f9 (patch)
tree752f1c26d1f122dcf58374ac78db109c9578be45 /vendor/librune/lib/mbstring/u8rlen.c
Genesis commit
Diffstat (limited to 'vendor/librune/lib/mbstring/u8rlen.c')
-rw-r--r--vendor/librune/lib/mbstring/u8rlen.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/librune/lib/mbstring/u8rlen.c b/vendor/librune/lib/mbstring/u8rlen.c
new file mode 100644
index 0000000..ac579c7
--- /dev/null
+++ b/vendor/librune/lib/mbstring/u8rlen.c
@@ -0,0 +1,20 @@
+#include <stddef.h>
+
+#include "mbstring.h"
+
+#include "internal/common.h"
+
+int
+u8rlen(const char8_t *s)
+{
+ if (U1(*s))
+ return 1;
+ else if (U2(*s))
+ return 2;
+ else if (U3(*s))
+ return 3;
+ else if (U4(*s))
+ return 4;
+
+ unreachable();
+}