aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/integers.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-09-06 14:47:45 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-09-06 14:47:45 -0400
commita8316252db95e3d77f9f0e9beb89cfcb4573d5b1 (patch)
treee5905bce9611e35ccb2f84481232fca0e657ff42 /src/stdlib/integers.c
parenta0ac652cd1eebdc42425b34f1685f8cb20cb4eea (diff)
parent73246764f88f6f652316ee0c138a990d836698a7 (diff)
Merge branch 'main' into simplified-quotes
Diffstat (limited to 'src/stdlib/integers.c')
-rw-r--r--src/stdlib/integers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/stdlib/integers.c b/src/stdlib/integers.c
index 7dda77bd..863bb42d 100644
--- a/src/stdlib/integers.c
+++ b/src/stdlib/integers.c
@@ -430,7 +430,7 @@ OptionalInt_t Int$parse(Text_t text, Text_t *remainder) {
else if (*end != '\0') return NONE_INT;
result = mpz_init_set_str(i, str + 2, 2);
} else {
- const char *end = str + 2 + strspn(str + 2, "0123456789");
+ const char *end = str + strspn(str, "0123456789");
if (remainder) *remainder = Text$from_str(end);
else if (*end != '\0') return NONE_INT;
result = mpz_init_set_str(i, str, 10);
@@ -618,6 +618,8 @@ void Int32$deserialize(FILE *in, void *outval, List_t *pointers, const TypeInfo_
return colorize ? Texts(Text("\033[35m"), text, Text("\033[m")) : text; \
} \
public \
+ Text_t KindOfInt##$value_as_text(c_type i) { return _int64_to_text((int64_t)i); } \
+ public \
PUREFUNC int32_t KindOfInt##$compare(const void *x, const void *y, const TypeInfo_t *info) { \
(void)info; \
return (*(c_type *)x > *(c_type *)y) - (*(c_type *)x < *(c_type *)y); \