Skip to content

Commit bb5eba4

Browse files
authored
Merge pull request #166 from jow-/fix-165
Fix 165
2 parents 4bee0ef + 093684d commit bb5eba4

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Diff for: lib/fs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ uc_fs_isatty(uc_vm_t *vm, size_t nargs)
838838
if (fd == -1)
839839
err_return(errno);
840840

841-
return ucv_boolean_new(isatty(fd));
841+
return ucv_boolean_new(isatty(fd) == 1);
842842
}
843843

844844
/**

Diff for: types.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -1998,7 +1998,7 @@ ucv_compare(int how, uc_value_t *v1, uc_value_t *v2, int *deltap)
19981998
uint64_t u1, u2;
19991999
int64_t n1, n2;
20002000
double d1, d2;
2001-
int8_t delta;
2001+
int delta;
20022002

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

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

0 commit comments

Comments
 (0)