aboutsummaryrefslogtreecommitdiffstats
path: root/libcharconv_sora_sompeng.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_sora_sompeng.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_sora_sompeng.c')
-rw-r--r--libcharconv_sora_sompeng.c54
1 files changed, 5 insertions, 49 deletions
diff --git a/libcharconv_sora_sompeng.c b/libcharconv_sora_sompeng.c
index 6ced61d..984d303 100644
--- a/libcharconv_sora_sompeng.c
+++ b/libcharconv_sora_sompeng.c
@@ -2,58 +2,14 @@
#include "lib-common.h"
-static struct {
- unsigned char cp_low;
- char latin;
-} sora_sompeng[] = {
- {0xE2, 'a'},
- {0xD2, 'b'},
- {0xD3, 'c'},
- {0xD4, 'd'},
- {0xE7, 'e'},
- {0xE3, 'E'},
- {0xD5, 'g'},
- {0xD7, 'G'},
- {0xDE, 'h'},
- {0xE4, 'i'},
- {0xE0, 'j'},
- {0xDF, 'k'},
- {0xD8, 'l'},
- {0xD9, 'n'},
- {0xD6, 'm'},
- {0xE8, 'M'},
- {0xE6, 'o'},
- {0xDB, 'p'},
- {0xDD, 'r'},
- {0xD0, 's'},
- {0xD1, 't'},
- {0xE5, 'u'},
- {0xDA, 'v'},
- {0xDC, 'y'},
- {0xE1, 'Y'},
- {0xF0, '0'},
- {0xF1, '1'},
- {0xF2, '2'},
- {0xF3, '3'},
- {0xF4, '4'},
- {0xF5, '5'},
- {0xF6, '6'},
- {0xF7, '7'},
- {0xF8, '8'},
- {0xF9, '9'}
-};
-
-
enum libcharconv_result
libcharconv_sora_sompeng(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(sora_sompeng) / sizeof(*sora_sompeng); i++)
- if (*s == sora_sompeng[i].latin)
- goto conv;
- *n += 1u;
+ for (; slen--; s++, ++*n) {
+ PLAIN_SELECT("stbcdgmGlnvpyrhkjYaEiuoeM", 0x110D0);
+ PLAIN_RANGE('0', '9', 0x110F0);
}
no_conv:
return LIBCHARCONV_NO_CONVERT;
@@ -62,7 +18,7 @@ conv:
if (*n)
goto no_conv;
if (*ncp)
- *cp = (uint_least32_t)(UINT32_C(0x11000) | sora_sompeng[i].cp_low);
+ *cp = c;
*n += 1u;
*ncp = 1u;
return LIBCHARCONV_CONVERTED;