From e15ab69e3cb393780ff5555dbd8a52aac493d1ec Mon Sep 17 00:00:00 2001 From: Bryan English Date: Fri, 30 Jan 2026 22:52:58 -0500 Subject: [PATCH] loop on the opposite condition --- rel-lang/relc/src/riscv_asm_codegen.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rel-lang/relc/src/riscv_asm_codegen.rs b/rel-lang/relc/src/riscv_asm_codegen.rs index 184a44a..69b39b4 100644 --- a/rel-lang/relc/src/riscv_asm_codegen.rs +++ b/rel-lang/relc/src/riscv_asm_codegen.rs @@ -306,10 +306,10 @@ impl<'a> CodeGen<'a> { } stack.pop(); }, - IR::Loop => { // keep looping as long as top of stack is true/0 + IR::Loop => { // keep looping until is true/0 self.label(format!("_loop_{}:", loop_count)); self.pop_to("t0"); - self.line(format!("bnez t0, _endloop_{}", loop_count)); + self.line(format!("beqz t0, _endloop_{}", loop_count)); loop_stack.push(loop_count); loop_count += 1; }, -- 2.43.0