Skip to content

Commit

Permalink
Merge pull request #1460 from actonlang/1459-fix-i64_eq-etc
Browse files Browse the repository at this point in the history
Fix i64 eq/ne/etc comparisons
  • Loading branch information
plajjan authored Aug 29, 2023
2 parents dee278b + 37e10a6 commit 1853406
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
12 changes: 6 additions & 6 deletions base/builtin/i64.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ B_i64 B_i64G_new(B_atom a);
// only called with e>=0.
long longpow(long a, long e); // used also for ndarrays

#define ORD_B_i64__eq__(a,b) (&a->val == &b->val)
#define ORD_B_i64__ne__(a,b) (&a->val != &b->val)
#define ORD_B_i64__lt__(a,b) (&a->val < &b->val)
#define ORD_B_i64__le__(a,b) (&a->val <= &b->val)
#define ORD_B_i64__gt__(a,b) (&a->val > &b->val)
#define ORD_B_i64__ge__(a,b) (&a->val >= &b->val)
#define ORD_B_i64__eq__(a,b) (a->val == b->val)
#define ORD_B_i64__ne__(a,b) (a->val != b->val)
#define ORD_B_i64__lt__(a,b) (a->val < b->val)
#define ORD_B_i64__le__(a,b) (a->val <= b->val)
#define ORD_B_i64__gt__(a,b) (a->val > b->val)
#define ORD_B_i64__ge__(a,b) (a->val >= b->val)
14 changes: 13 additions & 1 deletion test/builtins_auto/int.act
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
def test_i64():
x: i64 = 0
if (bool(x != 0)):
raise ValueError("unexpected: bool(x) != 0")
if x != 0:
raise ValueError("unexpected: x != 0")
return True


actor main(env):
if (141234567898765434567654345678765456787654 << 12) != 578496790113343219989112199900223311002230784:
raise ValueError("left shift of positive int broken")
Expand All @@ -24,5 +33,8 @@ actor main(env):
if int('123') != 123:
raise ValueError("int('123') != 123")
if hash(2**131) >= 2**64:
raise ValueError("hash(2**131) too big")
raise ValueError("hash(2**131) too big")
if not test_i64():
await async env.exit(1)

await async env.exit(0)

0 comments on commit 1853406

Please sign in to comment.