aboutsummaryrefslogtreecommitdiffstats
path: root/libcharconv_rotated_45deg_ccw.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_rotated_45deg_ccw.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_rotated_45deg_ccw.c')
-rw-r--r--libcharconv_rotated_45deg_ccw.c79
1 files changed, 2 insertions, 77 deletions
diff --git a/libcharconv_rotated_45deg_ccw.c b/libcharconv_rotated_45deg_ccw.c
index 7144041..13fbfc8 100644
--- a/libcharconv_rotated_45deg_ccw.c
+++ b/libcharconv_rotated_45deg_ccw.c
@@ -1,78 +1,3 @@
/* See LICENSE file for copyright and license details. */
-#include "lib-common.h"
-
-
-static struct {
- uint_least32_t to;
- uint_least32_t from;
-} pairs[] = {
- {UINT32_C(0x1FA04), UINT32_C(0x1FA08)},
- {UINT32_C(0x1FA08), UINT32_C(0x1FA19)},
- {UINT32_C(0x1FA19), UINT32_C(0x1FA1D)},
- {UINT32_C(0x1FA1D), UINT32_C(0x1FA2E)},
- {UINT32_C(0x1FA2E), UINT32_C(0x1FA32)},
- {UINT32_C(0x1FA32), UINT32_C(0x1FA43)},
- {UINT32_C(0x1FA43), UINT32_C(0x1FA47)},
- {UINT32_C(0x1FA47), UINT32_C(0x1FA04)},
- {UINT32_C(0x2658), UINT32_C(0x1FA06)},
- {UINT32_C(0x1FA06), UINT32_C(0x1FA0D)},
- {UINT32_C(0x1FA0D), UINT32_C(0x1FA1B)},
- {UINT32_C(0x1FA1B), UINT32_C(0x1FA22)},
- {UINT32_C(0x1FA22), UINT32_C(0x1FA30)},
- {UINT32_C(0x1FA30), UINT32_C(0x1FA37)},
- {UINT32_C(0x1FA37), UINT32_C(0x1FA45)},
- {UINT32_C(0x1FA45), UINT32_C(0x2658)},
- {UINT32_C(0x265E), UINT32_C(0x1FA07)},
- {UINT32_C(0x1FA07), UINT32_C(0x1FA13)},
- {UINT32_C(0x1FA13), UINT32_C(0x1FA1C)},
- {UINT32_C(0x1FA1C), UINT32_C(0x1FA28)},
- {UINT32_C(0x1FA28), UINT32_C(0x1FA31)},
- {UINT32_C(0x1FA31), UINT32_C(0x1FA3D)},
- {UINT32_C(0x1FA3D), UINT32_C(0x1FA46)},
- {UINT32_C(0x1FA46), UINT32_C(0x265E)}
-};
-
-
-enum libcharconv_result
-libcharconv_rotated_45deg_ccw(const char *s, size_t slen, size_t *n, uint_least32_t *cp, size_t *ncp)
-{
- uint_least32_t c;
- size_t i, clen;
- *n = 0;
- while (slen) {
- clen = libcharconv_decode_utf8_(s, slen, &c);
- if (clen > slen) {
- if (*n)
- goto no_conv;
- return LIBCHARCONV_INDETERMINATE;
- }
- if (!clen) {
- *n += 1u;
- slen -= 1u;
- s = &s[1];
- continue;
- }
-
- for (i = 0u; i < sizeof(pairs) / sizeof(*pairs); i++) {
- if (c == pairs[i].from) {
- c = pairs[i].to;
- goto conv;
- }
- }
-
- *n += clen;
- s = &s[clen];
- slen -= clen;
- }
-no_conv:
- return LIBCHARCONV_NO_CONVERT;
-
-conv:
- if (*n)
- goto no_conv;
- if (*ncp)
- *cp = c;
- *n += clen;
- *ncp = 1u;
- return LIBCHARCONV_CONVERTED;
-}
+#define REVERSED
+#include "libcharconv_rotated_45deg_cw.c"