aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-13 03:25:13 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-13 03:25:13 -0400
commitcf8c01845e67e9cee6d70917273ab8060cc90372 (patch)
treeb01fc8313864c6b21da287f76792d22cd74e8ef5
parentdf520b7d61f499e2b5deb0bb5ef8211f3c2aa3cd (diff)
Fix issue with integer comparisons
-rw-r--r--builtins/integers.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtins/integers.c b/builtins/integers.c
index de4c9b78..6a976d42 100644
--- a/builtins/integers.c
+++ b/builtins/integers.c
@@ -58,24 +58,24 @@ public CORD Int$as_text(const Int_t *i, bool colorize, const TypeInfo *type) {
public int32_t Int$compare(const Int_t *x, const Int_t *y, const TypeInfo *type) {
(void)type;
- if (__builtin_expect(((x->small & y->small) & 1) == 0, 0))
+ if (__builtin_expect(((x->small | y->small) & 1) == 0, 0))
return mpz_cmp(*x->big, *y->big);
return (x->small > y->small) - (x->small < y->small);
}
public int32_t Int$compare_value(const Int_t x, const Int_t y) {
- if (__builtin_expect(((x.small & y.small) & 1) == 0, 0))
+ if (__builtin_expect(((x.small | y.small) & 1) == 0, 0))
return mpz_cmp(*x.big, *y.big);
return (x.small > y.small) - (x.small < y.small);
}
public bool Int$equal(const Int_t *x, const Int_t *y, const TypeInfo *type) {
(void)type;
- return x->small == y->small || (__builtin_expect(((x->small & y->small) & 1) == 0, 0) && mpz_cmp(*x->big, *y->big) == 0);
+ return x->small == y->small || (__builtin_expect(((x->small | y->small) & 1) == 0, 0) && mpz_cmp(*x->big, *y->big) == 0);
}
public bool Int$equal_value(const Int_t x, const Int_t y) {
- return x.small == y.small || (__builtin_expect(((x.small & y.small) & 1) == 0, 0) && mpz_cmp(*x.big, *y.big) == 0);
+ return x.small == y.small || (__builtin_expect(((x.small | y.small) & 1) == 0, 0) && mpz_cmp(*x.big, *y.big) == 0);
}
public uint32_t Int$hash(const Int_t *x, const TypeInfo *type) {