From 053358c85411ca70a6d0868e5d8748b6200b0522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Thu, 23 May 2024 14:33:41 +0100 Subject: [PATCH] Fixes source register range checking for the destination register instead. --- src/assembler.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assembler.rs b/src/assembler.rs index 6b2aa348..477a571a 100644 --- a/src/assembler.rs +++ b/src/assembler.rs @@ -235,7 +235,7 @@ fn insn(opc: u8, dst: i64, src: i64, off: i64, imm: i64) -> Result if !(0..16).contains(&dst) { return Err(format!("Invalid destination register {dst}")); } - if dst < 0 || src >= 16 { + if !(0..16).contains(&src) { return Err(format!("Invalid source register {src}")); } if off < i16::MIN as i64 || off > i16::MAX as i64 {