Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 165 #166

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ uc_fs_isatty(uc_vm_t *vm, size_t nargs)
if (fd == -1)
err_return(errno);

return ucv_boolean_new(isatty(fd));
return ucv_boolean_new(isatty(fd) == 1);
}

/**
Expand Down
9 changes: 7 additions & 2 deletions types.c
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ ucv_compare(int how, uc_value_t *v1, uc_value_t *v2, int *deltap)
uint64_t u1, u2;
int64_t n1, n2;
double d1, d2;
int8_t delta;
int delta;

/* at least one operand is null and we compare for equality or inequality ... */
if ((!v1 || !v2) && (how == I_EQ || how == I_NE)) {
Expand All @@ -2015,7 +2015,12 @@ ucv_compare(int how, uc_value_t *v1, uc_value_t *v2, int *deltap)
/* ... both operands are of the same, non-scalar type... */
if (t1 == t2 && !ucv_is_scalar(v1)) {
/* ... compare memory addrs */
delta = (intptr_t)v1 - (intptr_t)v2;
if ((uintptr_t)v1 == (uintptr_t)v2)
delta = 0;
else if ((uintptr_t)v1 < (uintptr_t)v2)
delta = -1;
else
delta = 1;
}

/* ... operands are of different type or at least one is scalar... */
Expand Down