From 6f33b9301416d28ef1825358af58c0213ce7567f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 13 Aug 2024 03:05:56 -0400 Subject: Fix min/max --- compile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compile.c b/compile.c index 77157d43..b020a458 100644 --- a/compile.c +++ b/compile.c @@ -1776,7 +1776,9 @@ CORD compile(env_t *env, ast_t *ast) type_t *key_t = get_type(expr_env, key); CORD comparison; - if (key_t->tag == IntType || key_t->tag == NumType || key_t->tag == BoolType || key_t->tag == PointerType) + if (key_t->tag == IntType && Match(key_t, IntType)->bits == 0) + comparison = CORD_all("(Int$compare_value(", lhs_key, ", ", rhs_key, ")", (ast->tag == Min ? "<=" : ">="), "0)"); + else if (key_t->tag == IntType || key_t->tag == NumType || key_t->tag == BoolType || key_t->tag == PointerType) comparison = CORD_all("((", lhs_key, ")", (ast->tag == Min ? "<=" : ">="), "(", rhs_key, "))"); else if (key_t->tag == TextType) comparison = CORD_all("CORD_cmp(", lhs_key, ", ", rhs_key, ")", (ast->tag == Min ? "<=" : ">="), "0"); -- cgit v1.2.3