From 5c375633229a3930d49c1fc6cd75f266b84d5ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Wed, 11 Jan 2023 15:34:12 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Cleaned=20up=20clippy=20warnings?= =?UTF-8?q?=20for=20machine.rs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/simulator/machine.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/simulator/machine.rs b/src/simulator/machine.rs index 57f4550..57fd15e 100644 --- a/src/simulator/machine.rs +++ b/src/simulator/machine.rs @@ -23,7 +23,7 @@ impl Machine { value = (value << 32) + value; for item in &mut shiftmask { *item = value; - value = value >> 1; + value >>= 1; } Machine { @@ -202,8 +202,7 @@ impl Machine { machine.int_reg[inst.rd as usize] = machine.int_reg[inst.rs1 as usize] + inst.imm12_I_signed as i64; }, RISCV_OPI_SLTI => { - machine.int_reg[inst.rd as usize] = - if machine.int_reg[inst.rs1 as usize] < inst.imm12_I_signed as i64 { 1 } else { 0 }; + machine.int_reg[inst.rd as usize] = (machine.int_reg[inst.rs1 as usize] < inst.imm12_I_signed as i64) as i64; }, RISCV_OPI_XORI => { machine.int_reg[inst.rd as usize] = machine.int_reg[inst.rs1 as usize] ^ inst.imm12_I_signed as i64; @@ -378,6 +377,5 @@ impl Machine { #[cfg(test)] mod test { - use super::Machine; }