From: Bryan English Date: Sat, 31 Jan 2026 03:52:58 +0000 (-0500) Subject: loop on the opposite condition X-Git-Url: https://rethought.computer/gitweb//gitweb//git?a=commitdiff_plain;h=e15ab69e3cb393780ff5555dbd8a52aac493d1ec;p=sorel-lang.git loop on the opposite condition --- 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; },