From 40bf70fb8f23e5ff7212b568c69e0725372e5b57 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 28 Jan 2026 22:03:48 +0100 Subject: Clean up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libcharconv_superscript.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'libcharconv_superscript.c') diff --git a/libcharconv_superscript.c b/libcharconv_superscript.c index d15f490..9f83164 100644 --- a/libcharconv_superscript.c +++ b/libcharconv_superscript.c @@ -7,18 +7,10 @@ libcharconv_superscript(const char *s, size_t slen, size_t *n, uint_least32_t *c { uint_least32_t c; *n = 0; - for (; slen--; s++) { - if (*s == '1') { - c = (uint_least32_t)UINT32_C(0x00B9); - } else if ('2' <= *s && *s <= '3') { - c = (uint_least32_t)(UINT32_C(0x00B2) + (unsigned)(*s - '2')); - } else if ('0' <= *s && *s <= '9') { - c = (uint_least32_t)(UINT32_C(0x2070) + (unsigned)(*s - '0')); - } else { - *n += 1u; - continue; - } - goto conv; + for (; slen--; s++, ++*n) { + PLAIN_SINGLE('1', 0x00B9); + PLAIN_RANGE('2', '3', 0x00B2); + PLAIN_RANGE('0', '9', 0x2070); } no_conv: return LIBCHARCONV_NO_CONVERT; -- cgit v1.2.3-70-g09d2