aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/bigint.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2026-01-01 15:18:07 -0500
committerBruce Hill <bruce@bruce-hill.com>2026-01-01 15:18:07 -0500
commitce49f93da58d007c0a52ee82e2421adfe06012f9 (patch)
tree7d847576e26b038f986a15e11b498b04cec7a94a /src/stdlib/bigint.c
parentdbae987f1fb54da795185a03f4c00d56a639f8cd (diff)
Bugfix for integer comparison
Diffstat (limited to 'src/stdlib/bigint.c')
-rw-r--r--src/stdlib/bigint.c4
1 files changed, 2 insertions, 2 deletions
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);
}