aboutsummaryrefslogtreecommitdiffstats
path: root/libcharconv_lycian.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-01-28 22:03:48 +0100
committerMattias Andrée <m@maandree.se>2026-01-28 22:03:48 +0100
commit40bf70fb8f23e5ff7212b568c69e0725372e5b57 (patch)
tree0d4be706d0182ddeafd4eaafd073e12c2fa2a9e8 /libcharconv_lycian.c
parentMisc stuff (diff)
downloadcharconv-40bf70fb8f23e5ff7212b568c69e0725372e5b57.tar.gz
charconv-40bf70fb8f23e5ff7212b568c69e0725372e5b57.tar.bz2
charconv-40bf70fb8f23e5ff7212b568c69e0725372e5b57.tar.xz
Clean up
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'libcharconv_lycian.c')
-rw-r--r--libcharconv_lycian.c47
1 files changed, 4 insertions, 43 deletions
diff --git a/libcharconv_lycian.c b/libcharconv_lycian.c
index 7998ecb..f34adda 100644
--- a/libcharconv_lycian.c
+++ b/libcharconv_lycian.c
@@ -2,52 +2,13 @@
#include "lib-common.h"
-static struct {
- unsigned char cp_low;
- char latin;
-} lycian[] = {
- {0x80, 'a'},
- {0x82, 'b'},
- {0x85, 'd'},
- {0x81, 'e'},
- {0x84, 'g'},
- {0x9B, 'h'},
- {0x86, 'i'},
- {0x8A, 'j'},
- {0x8B, 'k'},
- {0x8D, 'l'},
- {0x8E, 'm'},
- {0x8F, 'n'},
- {0x93, 'p'},
- {0x8C, 'q'},
- {0x95, 'r'},
- {0x96, 's'},
- {0x97, 't'},
- {0x92, 'u'},
- {0x87, 'w'},
- {0x9C, 'x'},
- {0x88, 'z'},
- {0x99, 'A'},
- {0x83, 'B'},
- {0x89, 'D'},
- {0x9A, 'E'},
- {0x94, 'K'},
- {0x90, 'M'},
- {0x91, 'N'},
- {0x98, 'T'}
-};
-
-
enum libcharconv_result
libcharconv_lycian(const char *s, size_t slen, size_t *n, uint_least32_t *cp, size_t *ncp)
{
- size_t i;
+ uint_least32_t c;
*n = 0;
- for (; slen--; s++) {
- for (i = 0u; i < sizeof(lycian) / sizeof(*lycian); i++)
- if (*s == lycian[i].latin)
- goto conv;
- *n += 1u;
+ for (; slen--; s++, ++*n) {
+ PLAIN_SELECT("aebBgdiwzDjkqlmnMNupKrstTAEhx", 0x10280);
}
no_conv:
return LIBCHARCONV_NO_CONVERT;
@@ -56,7 +17,7 @@ conv:
if (*n)
goto no_conv;
if (*ncp)
- *cp = (uint_least32_t)(UINT32_C(0x10200) | lycian[i].cp_low);
+ *cp = c;
*n += 1u;
*ncp = 1u;
return LIBCHARCONV_CONVERTED;