aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-11-05 15:18:32 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-11-05 15:18:32 -0500
commitb8d7eabc023bf9db0150049d8e909086f6ad91bc (patch)
tree5b678c7949638b3f07095affc04611f0422ef8c7 /stdlib
parent2fa26e6af3ec1599396d9260ef44b0d035b1f686 (diff)
Deprecate bit-width integer/num literals in favor of using type
constructors
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/bytes.c2
-rw-r--r--stdlib/integers.c10
-rw-r--r--stdlib/nums.c2
3 files changed, 7 insertions, 7 deletions
diff --git a/stdlib/bytes.c b/stdlib/bytes.c
index 8d665790..f36a56ba 100644
--- a/stdlib/bytes.c
+++ b/stdlib/bytes.c
@@ -14,7 +14,7 @@ PUREFUNC public Text_t Byte$as_text(const Byte_t *b, bool colorize, const TypeIn
{
(void)type;
if (!b) return Text("Byte");
- return Text$format(colorize ? "\x1b[35m%u[B]\x1b[m" : "%u[B]", *b);
+ return Text$format(colorize ? "\x1b[36mByte\x1b[m(\x1b[35m0x%02X\x1b[m)" : "Byte(0x%02X)", *b);
}
public const TypeInfo_t Byte$info = {
diff --git a/stdlib/integers.c b/stdlib/integers.c
index f6140da4..9bde1890 100644
--- a/stdlib/integers.c
+++ b/stdlib/integers.c
@@ -377,7 +377,7 @@ public const TypeInfo_t Int$info = {
public Text_t KindOfInt ## $as_text(const c_type *i, bool colorize, const TypeInfo_t *type) { \
(void)type; \
if (!i) return Text(#KindOfInt); \
- return Text$format(colorize ? "\x1b[35m%" fmt "\x1b[m" : "%" fmt, *i); \
+ return Text$format(colorize ? "\x1b[36m" #KindOfInt "\x1b[m(\x1b[35m" fmt "\x1b[m)" : #KindOfInt "(" fmt ")", *i); \
} \
public PUREFUNC int32_t KindOfInt ## $compare(const c_type *x, const c_type *y, const TypeInfo_t *type) { \
(void)type; \
@@ -431,10 +431,10 @@ public const TypeInfo_t Int$info = {
.CustomInfo={.compare=(void*)KindOfInt##$compare, .as_text=(void*)KindOfInt##$as_text}, \
};
-DEFINE_INT_TYPE(int64_t, Int64, "ld[64]", INT64_MIN, INT64_MAX, __attribute__(()))
-DEFINE_INT_TYPE(int32_t, Int32, "d[32]", INT32_MIN, INT32_MAX, CONSTFUNC)
-DEFINE_INT_TYPE(int16_t, Int16, "d[16]", INT16_MIN, INT16_MAX, CONSTFUNC)
-DEFINE_INT_TYPE(int8_t, Int8, "d[8]", INT8_MIN, INT8_MAX, CONSTFUNC)
+DEFINE_INT_TYPE(int64_t, Int64, "%ld", INT64_MIN, INT64_MAX, __attribute__(()))
+DEFINE_INT_TYPE(int32_t, Int32, "%d", INT32_MIN, INT32_MAX, CONSTFUNC)
+DEFINE_INT_TYPE(int16_t, Int16, "%d", INT16_MIN, INT16_MAX, CONSTFUNC)
+DEFINE_INT_TYPE(int8_t, Int8, "%d", INT8_MIN, INT8_MAX, CONSTFUNC)
#undef DEFINE_INT_TYPE
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/stdlib/nums.c b/stdlib/nums.c
index b8de553e..30973fbc 100644
--- a/stdlib/nums.c
+++ b/stdlib/nums.c
@@ -93,7 +93,7 @@ public const TypeInfo_t Num$info = {
public PUREFUNC Text_t Num32$as_text(const float *f, bool colorize, const TypeInfo_t *type) {
(void)type;
if (!f) return Text("Num32");
- return Text$format(colorize ? "\x1b[35m%.8g_f32\x1b[33;2m\x1b[m" : "%.8g_f32", (double)*f);
+ return Text$format(colorize ? "\x1b[36mNum32(\x1b[35m%.8g\x1b[33;2m\x1b[m)" : "Num32(%.8g)", (double)*f);
}
public PUREFUNC int32_t Num32$compare(const float *x, const float *y, const TypeInfo_t *type) {