From f6b9957eab55b6a35258a2bffe67a076a0204254 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Sat, 13 Sep 2025 09:04:50 +1200 Subject: Report correct length after truncation After the trailing null bytes have been truncated from the end of the assembled program, the length being reported was the original untruncated length of the program, not the new length. --- src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3f7bf59..76ec544 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -148,9 +148,10 @@ pub fn assemble(mut args: Switchboard, invocation: &str) -> ! { while let Some(0) = bytecode.last() { bytecode.pop(); } - let difference = length - bytecode.len(); + let new_length = bytecode.len(); + let difference = length - new_length; if difference > 0 { - info!("Truncated program to {length} bytes (saved {difference} bytes)"); + info!("Truncated program to {new_length} bytes (saved {difference} bytes)"); } } -- cgit v1.2.3-70-g09d2