From 7c4b779797c4297e028ddc2ee5243a8156ebba9b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 24 Jan 2026 23:24:26 +0100 Subject: Improve go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libcharconv.h | 6 ++++-- libcharconv_go_black.c | 4 ++++ libcharconv_go_white.c | 4 ++++ libcharconv_latin.c | 6 ++++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libcharconv.h b/libcharconv.h index 0a34555..b1d6599 100644 --- a/libcharconv.h +++ b/libcharconv.h @@ -84,7 +84,8 @@ enum libcharconv_result libcharconv_dice(const char *s, size_t slen, size_t *n, /** * Convert - * '0' to WHITE CIRCLE, + * '0', 'w', and 'W' to WHITE CIRCLE, + * 'b' and 'B' to BLACK CIRCLE, * '1' to WHITE CIRCLE WITH DOT RIGHT, and * '2' to WHITE CIRCLE WITH TWO DOTS * @@ -119,7 +120,8 @@ enum libcharconv_result libcharconv_go_white(const char *s, size_t slen, size_t /** * Convert - * '0' to BLACK CIRCLE, + * '0', 'b', and 'B' to BLACK CIRCLE, + * 'w', and 'W' to WHITE CIRCLE, * '1' to BLACK CIRCLE WITH WHITE DOT RIGHT, and * '2' to BLACK CIRCLE WITH TWO WHITE DOTS * diff --git a/libcharconv_go_black.c b/libcharconv_go_black.c index 6ca0886..5845f5d 100644 --- a/libcharconv_go_black.c +++ b/libcharconv_go_black.c @@ -9,6 +9,10 @@ libcharconv_go_black(const char *s, size_t slen, size_t *n, uint_least32_t *cp, *n = 0; for (; slen--; s++) { switch (*s) { + case 'w': + case 'W': c = UINT32_C(0x25CB); goto conv; + case 'b': + case 'B': case '0': c = UINT32_C(0x25CF); goto conv; case '1': c = UINT32_C(0x2688); goto conv; case '2': c = UINT32_C(0x2689); goto conv; diff --git a/libcharconv_go_white.c b/libcharconv_go_white.c index 163a938..43509b2 100644 --- a/libcharconv_go_white.c +++ b/libcharconv_go_white.c @@ -9,6 +9,10 @@ libcharconv_go_white(const char *s, size_t slen, size_t *n, uint_least32_t *cp, *n = 0; for (; slen--; s++) { switch (*s) { + case 'b': + case 'B': c = UINT32_C(0x25CF); goto conv; + case 'w': + case 'W': case '0': c = UINT32_C(0x25CB); goto conv; case '1': c = UINT32_C(0x2686); goto conv; case '2': c = UINT32_C(0x2687); goto conv; diff --git a/libcharconv_latin.c b/libcharconv_latin.c index 7c70318..5179388 100644 --- a/libcharconv_latin.c +++ b/libcharconv_latin.c @@ -358,13 +358,15 @@ libcharconv_latin(const char *s, size_t slen, size_t *n, uint_least32_t *cp, siz case UINT32_C(0x26C9): c = (uint_least32_t)'W'; goto conv; case UINT32_C(0x26CA): c = (uint_least32_t)'B'; goto conv; + /* go (common) */ + case UINT32_C(0x25CF): c = (uint_least32_t)'b'; goto conv; + case UINT32_C(0x25CB): c = (uint_least32_t)'w'; goto conv; + /* go (white) */ - case UINT32_C(0x25CB): c = (uint_least32_t)'0'; goto conv; case UINT32_C(0x2686): c = (uint_least32_t)'1'; goto conv; case UINT32_C(0x2687): c = (uint_least32_t)'2'; goto conv; /* go (black) */ - case UINT32_C(0x25CF): c = (uint_least32_t)'0'; goto conv; case UINT32_C(0x2688): c = (uint_least32_t)'1'; goto conv; case UINT32_C(0x2689): c = (uint_least32_t)'2'; goto conv; -- cgit v1.2.3-70-g09d2