aboutsummaryrefslogtreecommitdiffstats
path: root/libcharconv_chess_black.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_chess_black.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_chess_black.c')
-rw-r--r--libcharconv_chess_black.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/libcharconv_chess_black.c b/libcharconv_chess_black.c
index 906c2f7..480c872 100644
--- a/libcharconv_chess_black.c
+++ b/libcharconv_chess_black.c
@@ -7,26 +7,11 @@ libcharconv_chess_black(const char *s, size_t slen, size_t *n, uint_least32_t *c
{
uint_least32_t c;
*n = 0;
- for (; slen--; s++) {
- switch (*s) {
- case 'K': c = UINT32_C(0x2654); goto conv;
- case 'Q': c = UINT32_C(0x2655); goto conv;
- case 'R': c = UINT32_C(0x2656); goto conv;
- case 'B': c = UINT32_C(0x2657); goto conv;
- case 'N': c = UINT32_C(0x2658); goto conv;
- case 'P': c = UINT32_C(0x2659); goto conv;
- case 'E': c = UINT32_C(0x1FA48); goto conv;
- case 'k': c = UINT32_C(0x265A); goto conv;
- case 'q': c = UINT32_C(0x265B); goto conv;
- case 'r': c = UINT32_C(0x265C); goto conv;
- case 'b': c = UINT32_C(0x265D); goto conv;
- case 'n': c = UINT32_C(0x265E); goto conv;
- case 'p': c = UINT32_C(0x265F); goto conv;
- case 'e': c = UINT32_C(0x1FA49); goto conv;
- default:
- *n += 1u;
- break;
- }
+ for (; slen--; s++, ++*n) {
+ PLAIN_SELECT("KQRBNP", 0x2654);
+ PLAIN_SELECT("kqrbnp", 0x265A);
+ PLAIN_SINGLE('E', 0x1FA48);
+ PLAIN_SINGLE('e', 0x1FA49);
}
no_conv:
return LIBCHARCONV_NO_CONVERT;