diff --git a/c/cvalues.h b/c/cvalues.h index 6771323..064b976 100644 --- a/c/cvalues.h +++ b/c/cvalues.h @@ -1139,7 +1139,7 @@ static value_t fl_neg(value_t n) { if (isfixnum(n)) { fixnum_t s = fixnum(-numval(n)); - if (__unlikely(s == n)) + if (__unlikely(n == (ufixnum_t)s)) return mk_long(-numval(n)); // negate overflows else return s; diff --git a/c/flisp.c b/c/flisp.c index 149436d..b920d45 100644 --- a/c/flisp.c +++ b/c/flisp.c @@ -1490,7 +1490,7 @@ apply_cl_top: do_neg: if (isfixnum(Stack[SP - 1])) { s = fixnum(-numval(Stack[SP - 1])); - if (__unlikely(s == Stack[SP - 1])) + if (__unlikely(Stack[SP - 1] == (ufixnum_t)s)) Stack[SP - 1] = mk_long(-numval(Stack[SP - 1])); // negate overflows else diff --git a/c/ios.c b/c/ios.c index 793f3fd..baeb4b5 100644 --- a/c/ios.c +++ b/c/ios.c @@ -970,7 +970,7 @@ int ios_vprintf(struct ios *s, const char *format, va_list args) va_end(al); return c; } - if (c < avail) { + if (avail > (size_t)c) { s->bpos += (size_t)c; _write_update_pos(s); // TODO: only works right if newline is at end