From 1ce826b9c3e9e57fe3acbd2abb5252bdeb630963 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 13 Aug 2024 11:35:22 -0400 Subject: Tweak to codegen for range iteration --- compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile.c b/compile.c index 333c54fe..8c7dc6df 100644 --- a/compile.c +++ b/compile.c @@ -852,7 +852,7 @@ CORD compile_statement(env_t *env, ast_t *ast) "const Range_t range = ", range, ";\n" "if (range.step.small == 0) fail(\"This range has a 'step' of zero and will loop infinitely!\");\n" "bool negative = (Int$compare_value(range.step, I(0)) < 0);\n" - "for (Int_t ", value, " = range.first; negative ? Int$compare_value(", value, ", range.last) >= 0 : Int$compare_value(", value, ", range.last) <= 0 ; ", value, " = Int$plus(", value, ", range.step)) {\n" + "for (Int_t ", value, " = range.first; ({ int32_t cmp = Int$compare_value(", value, ", range.last); negative ? cmp >= 0 : cmp <= 0;}) ; ", value, " = Int$plus(", value, ", range.step)) {\n" "\t", body, "\n}", stop, -- cgit v1.2.3