diff options
| author | Mattias Andrée <m@maandree.se> | 2026-01-28 22:03:48 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-01-28 22:03:48 +0100 |
| commit | 40bf70fb8f23e5ff7212b568c69e0725372e5b57 (patch) | |
| tree | 0d4be706d0182ddeafd4eaafd073e12c2fa2a9e8 /libcharconv_mandaic.c | |
| parent | Misc stuff (diff) | |
| download | charconv-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_mandaic.c')
| -rw-r--r-- | libcharconv_mandaic.c | 51 |
1 files changed, 6 insertions, 45 deletions
diff --git a/libcharconv_mandaic.c b/libcharconv_mandaic.c index a29ea66..7845fcb 100644 --- a/libcharconv_mandaic.c +++ b/libcharconv_mandaic.c @@ -2,54 +2,15 @@ #include "lib-common.h" -static struct { - unsigned char cp_low; - char latin; -} mandaic[] = { - {0x40, 'a'}, - {0x41, 'b'}, - {0x42, 'g'}, - {0x43, 'd'}, - {0x44, 'h'}, - {0x45, 'u'}, - {0x45, 'w'}, - {0x46, 'z'}, - {0x47, 'H'}, - {0x48, 'T'}, - {0x49, 'j'}, - {0x49, 'j'}, - {0x4A, 'k'}, - {0x4B, 'l'}, - {0x4C, 'm'}, - {0x4D, 'n'}, - {0x4E, 's'}, - {0x4F, 'e'}, - {0x50, 'p'}, - {0x51, 'Z'}, - {0x52, 'q'}, - {0x53, 'r'}, - {0x54, 'S'}, - {0x55, 't'}, - {0x56, 'D'}, - {0x57, 'K'}, - {0x58, 'o'}, - {0x59, '\''}, - {0x5A, '*'}, - {0x5B, ':'}, - {0x5E, '.'} -}; - - enum libcharconv_result libcharconv_mandaic(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(mandaic) / sizeof(*mandaic); i++) - if (*s == mandaic[i].latin) - goto conv; - *n += 1u; + for (; slen--; s++, ++*n) { + PLAIN_SELECT("abgdhuzHTjklmnsepZqrStDKo'*:", 0x0840); + PLAIN_SINGLE('.', 0x085E); + PLAIN_SINGLE('w', 0x0845); } no_conv: return LIBCHARCONV_NO_CONVERT; @@ -59,7 +20,7 @@ conv: goto no_conv; *n += 1u; if (*ncp) - *cp = (uint_least32_t)(UINT32_C(0x0800) | mandaic[i].cp_low); + *cp = c; *ncp = 1u; return LIBCHARCONV_CONVERTED; } |
