aboutsummaryrefslogtreecommitdiffstats
path: root/libcharconv_turned.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-01-25 23:08:40 +0100
committerMattias Andrée <m@maandree.se>2026-01-25 23:08:40 +0100
commitd0caefee7e2a45aebf14a6911021c7af9aed2a9f (patch)
tree72c074eebb678316d6e636767ab29494ef102b30 /libcharconv_turned.c
parentAdd control character representations (diff)
downloadcharconv-d0caefee7e2a45aebf14a6911021c7af9aed2a9f.tar.gz
charconv-d0caefee7e2a45aebf14a6911021c7af9aed2a9f.tar.bz2
charconv-d0caefee7e2a45aebf14a6911021c7af9aed2a9f.tar.xz
Add chess
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--libcharconv_turned.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/libcharconv_turned.c b/libcharconv_turned.c
index 33b8a31..2ff3e5a 100644
--- a/libcharconv_turned.c
+++ b/libcharconv_turned.c
@@ -6,14 +6,14 @@ static struct {
uint_least32_t a;
uint_least32_t b;
} pairs[] = {
- {0x0032, 0x218A},
- {0x0033, 0x218B},
- {0x2616, 0x26C9},
- {0x2617, 0x26CA},
- {0x0021, 0x00A1},
- {0x003F, 0x00BF},
- {0x2E35, 0x003B},
- {0x203D, 0x2E18},
+ {UINT32_C(0x0032), UINT32_C(0x218A)},
+ {UINT32_C(0x0033), UINT32_C(0x218B)},
+ {UINT32_C(0x2616), UINT32_C(0x26C9)},
+ {UINT32_C(0x2617), UINT32_C(0x26CA)},
+ {UINT32_C(0x0021), UINT32_C(0x00A1)},
+ {UINT32_C(0x003F), UINT32_C(0x00BF)},
+ {UINT32_C(0x2E35), UINT32_C(0x003B)},
+ {UINT32_C(0x203D), UINT32_C(0x2E18)},
{UINT32_C(0xA4EF), (uint_least32_t)'A'},
{UINT32_C(0xA4ED), (uint_least32_t)'B'},
{UINT32_C(0xA4DB), (uint_least32_t)'C'},
@@ -57,7 +57,19 @@ libcharconv_turned(const char *s, size_t slen, size_t *n, uint_least32_t *cp, si
continue;
}
- if (UINT32_C(0x1F031) <= c && c <= UINT32_C(0x1F061)) {
+ if (UINT32_C(0x1FA00) <= c && c <= UINT32_C(0x1FA1D)) {
+ c += 0x2Au;
+ goto conv;
+ } else if (UINT32_C(0x1FA2A) <= c && c <= UINT32_C(0x1FA47)) {
+ c -= 0x2Au;
+ goto conv;
+ } else if (UINT32_C(0x1FA1E) <= c && c <= UINT32_C(0x1FA29)) {
+ c -= UINT32_C(0x1FA1E) - UINT32_C(0x2654);
+ goto conv;
+ } else if (UINT32_C(0x2654) <= c && c <= UINT32_C(0x265F)) {
+ c += UINT32_C(0x1FA1E) - UINT32_C(0x2654);
+ goto conv;
+ } else if (UINT32_C(0x1F031) <= c && c <= UINT32_C(0x1F061)) {
c -= UINT32_C(0x1F031);
c = c % 7u * 7u + c / 7u;
c += UINT32_C(0x1F031);