From d0caefee7e2a45aebf14a6911021c7af9aed2a9f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 25 Jan 2026 23:08:40 +0100 Subject: Add chess MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libcharconv_latin.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libcharconv_latin.c') diff --git a/libcharconv_latin.c b/libcharconv_latin.c index 047dee5..2668ab1 100644 --- a/libcharconv_latin.c +++ b/libcharconv_latin.c @@ -460,6 +460,19 @@ libcharconv_latin(const char *s, size_t slen, size_t *n, uint_least32_t *cp, siz })[c & 0xFF]; goto conv_str; + } else if (UINT32_C(0x2654) <= c && c <= UINT32_C(0x265F)) { + /* chess */ + c = (uint_least32_t)"kqrbnpKQRBNP"[c - UINT32_C(0x2654)]; + goto conv; + } else if (UINT32_C(0x1FA00) <= c && c <= UINT32_C(0x1FA47)) { + /* chess */ + c = (uint_least32_t)"kqrbnpnNnkqrbnpKQRBNP"[(c - UINT32_C(0x1FA00)) % 21u]; + goto conv; + } else if (UINT32_C(0x1FA48) <= c && c <= UINT32_C(0x1FA4D)) { + /* chess */ + c = (uint_least32_t)"eEe"[(c - UINT32_C(0x1FA48)) % 3u]; + goto conv; + } else { use_switch: switch (c) { @@ -655,6 +668,12 @@ libcharconv_latin(const char *s, size_t slen, size_t *n, uint_least32_t *cp, siz /* overlaid */ case UINT32_C(0x203D): case UINT32_C(0x2E18): c1 = '!'; c2 = '?'; goto conv2; + case UINT32_C(0x1FA4E): c1 = 'n'; c2 = 'q'; goto conv2; + case UINT32_C(0x1FA4F): c1 = 'n'; c2 = 'r'; goto conv2; + case UINT32_C(0x1FA50): c1 = 'n'; c2 = 'b'; goto conv2; + case UINT32_C(0x1FA51): c1 = 'N'; c2 = 'Q'; goto conv2; + case UINT32_C(0x1FA52): c1 = 'N'; c2 = 'R'; goto conv2; + case UINT32_C(0x1FA53): c1 = 'N'; c2 = 'B'; goto conv2; /* joined */ case UINT32_C(0x2048): c1 = '?'; c2 = '!'; goto conv2; -- cgit v1.2.3-70-g09d2