From cfce376f585e0cd0231e95843617f75bd65b6c07 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 28 Dec 2025 17:27:05 -0500 Subject: Change autoformatter to no longer allow single-line functions --- src/stdlib/bigint.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/stdlib/bigint.c') diff --git a/src/stdlib/bigint.c b/src/stdlib/bigint.c index 2d145bd5..c9bfb68e 100644 --- a/src/stdlib/bigint.c +++ b/src/stdlib/bigint.c @@ -393,7 +393,9 @@ PUREFUNC Closure_t Int$onward(Int_t first, Int_t step) { } public -Int_t Int$from_str(const char *str) { return Int$parse(Text$from_str(str), NONE_INT, NULL); } +Int_t Int$from_str(const char *str) { + return Int$parse(Text$from_str(str), NONE_INT, NULL); +} public OptionalInt_t Int$parse(Text_t text, OptionalInt_t base, Text_t *remainder) { -- cgit v1.2.3 From dbae987f1fb54da795185a03f4c00d56a639f8cd Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 31 Dec 2025 15:13:32 -0500 Subject: Changed is_between() to be bidirectional --- src/stdlib/bigint.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/stdlib/bigint.c') diff --git a/src/stdlib/bigint.c b/src/stdlib/bigint.c index c9bfb68e..e2935332 100644 --- a/src/stdlib/bigint.c +++ b/src/stdlib/bigint.c @@ -102,7 +102,9 @@ CONSTFUNC Int_t Int$clamped(Int_t x, Int_t low, Int_t high) { public CONSTFUNC bool Int$is_between(const Int_t x, const Int_t low, const Int_t high) { - return Int$compare_value(low, x) <= 0 && Int$compare_value(x, high) <= 0; + int32_t low_cmp = Int$compare_value(x, low); + int32_t high_cmp = Int$compare_value(x, high); + return (low_cmp >= 0 && high_cmp <= 0) || (low_cmp <= 0 && high_cmp >= 0); } public -- cgit v1.2.3 From ce49f93da58d007c0a52ee82e2421adfe06012f9 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 1 Jan 2026 15:18:07 -0500 Subject: Bugfix for integer comparison --- src/stdlib/bigint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/stdlib/bigint.c') diff --git a/src/stdlib/bigint.c b/src/stdlib/bigint.c index e2935332..8bffbaf1 100644 --- a/src/stdlib/bigint.c +++ b/src/stdlib/bigint.c @@ -72,8 +72,8 @@ static bool Int$is_none(const void *i, const TypeInfo_t *info) { public PUREFUNC int32_t Int$compare_value(const Int_t x, const Int_t y) { if (likely(x.small & y.small & 1L)) return (x.small > y.small) - (x.small < y.small); - else if (x.small & 1) return -mpz_cmp_si(y.big, x.small); - else if (y.small & 1) return mpz_cmp_si(x.big, y.small); + else if (x.small & 1) return -mpz_cmp_si(y.big, (x.small >> 2)); + else if (y.small & 1) return mpz_cmp_si(x.big, (y.small >> 2)); else return x.big == y.big ? 0 : mpz_cmp(x.big, y.big); } -- cgit v1.2.3