diff options
author | iximeow <me@iximeow.net> | 2022-01-02 19:06:00 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2022-01-02 19:06:00 -0800 |
commit | fe9c41db5e4f2916439dd268a1b5e65447396ce3 (patch) | |
tree | 36a7ced4c0f76ea5b3e8971169aa50983e391a09 | |
parent | 6a018dc137ee149a65c1773c0bc6ab4e9732f7c4 (diff) |
some verbose display stuff
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 6a3d3ac..3e9b887 100644 --- a/src/main.rs +++ b/src/main.rs @@ -161,7 +161,7 @@ fn with_parsed_superh<F: FnOnce(yaxpeax_superh::SuperHDecoder)>( // yaxpeax-arch while older decoders are still being updated. mod current_arch { use yaxpeax_arch_02::{AddressBase, Arch, Decoder, Instruction, LengthedInstruction, Reader, U8Reader}; - use yaxpeax_arch_02::{AnnotatingDecoder, FieldDescription, VecSink}; + use yaxpeax_arch_02::annotation::{AnnotatingDecoder, FieldDescription, VecSink}; use std::fmt; use num_traits::identities::Zero; @@ -351,19 +351,21 @@ mod current_arch { let mut fudge = 0; let mut col = [b' '; 160]; + let mut line_end = 0; for i in 0..160 { - if (i >> 3) >= data.len() { + if (i >> 3) > data.len() { continue; } if boundaries[i] { col[i + fudge] = b'|'; + line_end = i + fudge + 1; } if fudge_bits[i] { fudge += 1; } } - res.push_str(unsafe { std::str::from_utf8_unchecked(&col) }); + res.push_str(unsafe { std::str::from_utf8_unchecked(&col[..line_end]) }); res.push_str("\n"); for (field_index, bit) in boundary_order { @@ -371,7 +373,7 @@ mod current_arch { let mut col = [b' '; 160]; for i in 0..160 { - if (i >> 3) >= data.len() { + if (i >> 3) > data.len() { continue; } |