diff --git a/src/library/exec.rs b/src/library/exec.rs index b2590bd..17aaffe 100644 --- a/src/library/exec.rs +++ b/src/library/exec.rs @@ -258,12 +258,12 @@ impl Lib { ExecStep::Call(site) => { #[cfg(feature = "log")] eprintln!("{d}calling{z} {m}{site}{z}"); - return Jump::Instr(site.into()); + return Jump::Instr(site); } ExecStep::Ret(site) => { #[cfg(feature = "log")] eprintln!("{d}returning to{z} {m}{site}{z}"); - return Jump::Next(site.into()); + return Jump::Next(site); } } } diff --git a/src/library/lib.rs b/src/library/lib.rs index 532dc78..01aad71 100644 --- a/src/library/lib.rs +++ b/src/library/lib.rs @@ -134,7 +134,7 @@ impl Display for Lib { writeln!(f, "ISAE: {}", self.isae_string())?; writeln!(f, "CODE: {:x}", self.code)?; writeln!(f, "DATA: {:x}", self.data)?; - if self.libs.len() > 0 { + if !self.libs.is_empty() { writeln!( f, "LIBS: {:8}", diff --git a/src/library/marshaller.rs b/src/library/marshaller.rs index eb8abd0..2ad30b5 100644 --- a/src/library/marshaller.rs +++ b/src/library/marshaller.rs @@ -194,7 +194,7 @@ where fn write(&mut self, value: u32, bit_count: u5) -> Result<(), CodeEofError> { let mut cnt = bit_count.to_u8(); let value = ((value as u64) << (self.bit_pos.to_u8())).to_le_bytes(); - let n_bytes = (cnt + self.bit_pos.to_u8() + 7) / 8; + let n_bytes = (cnt + self.bit_pos.to_u8()).div_ceil(8); for i in 0..n_bytes { if self.bytecode.as_ref().len() >= u16::MAX as usize { return Err(CodeEofError);