aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/intX.c.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-10-20 00:50:55 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-10-20 00:50:55 -0400
commit3c7fcae919d9bca3184bb558c922dfd342fee205 (patch)
tree0d6cddce92a7874686aa00d3b0f9f0cedb655cee /src/stdlib/intX.c.h
parentc4585d7cfd92a295e17500a0d3ddfedf95d92cdd (diff)
Clean up macro code
Diffstat (limited to 'src/stdlib/intX.c.h')
-rw-r--r--src/stdlib/intX.c.h32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/stdlib/intX.c.h b/src/stdlib/intX.c.h
index 9c096a19..0e665591 100644
--- a/src/stdlib/intX.c.h
+++ b/src/stdlib/intX.c.h
@@ -20,23 +20,18 @@
#define INTX_C_H__INT_BITS 32
#endif
-#define PASTE3_(a, b, c) a##b##c
-#define PASTE3(a, b, c) PASTE3_(a, b, c)
-#define INT_T PASTE3(int, INTX_C_H__INT_BITS, _t)
-
+#define CAT_(a, b) a##b
+#define CAT(a, b) CAT_(a, b)
#define STRINGIFY_(s) #s
#define STRINGIFY(s) STRINGIFY_(s)
-#define NAME_STR "Int" STRINGIFY(INTX_C_H__INT_BITS)
-#define UNSIGNED_(t) u##t
-#define UNSIGNED(t) UNSIGNED_(t)
-#define UINT_T UNSIGNED(INT_T)
+#define INT_T CAT(CAT(int, INTX_C_H__INT_BITS), _t)
+#define UINT_T CAT(CAT(uint, INTX_C_H__INT_BITS), _t)
+#define OPT_T CAT(CAT(OptionalInt, INTX_C_H__INT_BITS), _t)
-#define OPT_T PASTE3(OptionalInt, INTX_C_H__INT_BITS, _t)
+#define NAME_STR "Int" STRINGIFY(INTX_C_H__INT_BITS)
-#define PASTE4_(a, b, c, d) a##b##c##d
-#define PASTE4(a, b, c, d) PASTE4_(a, b, c, d)
-#define NAMESPACED(method_name) PASTE4(Int, INTX_C_H__INT_BITS, $, method_name)
+#define NAMESPACED(method_name) CAT(CAT(Int, INTX_C_H__INT_BITS), CAT($, method_name))
static Text_t _int64_to_text(int64_t n) {
if (n == INT64_MIN) return Text("-9223372036854775808");
@@ -260,16 +255,13 @@ const TypeInfo_t NAMESPACED(info) = {
},
};
-#undef PASTE3_
-#undef PASTE3
-#undef INT_T
+#undef CAT_
+#undef CAT
#undef STRINGIFY_
#undef STRINGIFY
-#undef NAME_STR
-#undef UNSIGNED_
-#undef UNSIGNED
+#undef INT_T
#undef UINT_T
#undef OPT_T
-#undef PASTE4_
-#undef PASTE4
+#undef NAME_STR
#undef NAMESPACED
+#undef INTX_C_H__INT_BITS