aboutsummaryrefslogtreecommitdiff
path: root/lib/mbstring/u8cmp.c
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-03-06 16:41:59 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-03-06 16:43:45 +0100
commit5ecd0fc61a1a292426538fcb1e791342e04953b5 (patch)
tree6cdaaf37b22cf834dc1f6089693183d6e6504878 /lib/mbstring/u8cmp.c
Genesis
Diffstat (limited to 'lib/mbstring/u8cmp.c')
-rw-r--r--lib/mbstring/u8cmp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/mbstring/u8cmp.c b/lib/mbstring/u8cmp.c
new file mode 100644
index 0000000..732896c
--- /dev/null
+++ b/lib/mbstring/u8cmp.c
@@ -0,0 +1,11 @@
+#include <string.h>
+
+#include "mbstring.h"
+
+int
+u8cmp(struct u8view x, struct u8view y)
+{
+ if (x.len != y.len)
+ return x.len > y.len ? +1 : -1;
+ return memcmp(x.p, y.p, x.len);
+}