From 7c2a57616adad4d5600018af44a438c7659aa086 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 12 Apr 2024 21:58:51 -0400 Subject: Fix padding Signed-off-by: Ian Moffett --- src/mex.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/mex.c') diff --git a/src/mex.c b/src/mex.c index a4208c0..3b69268 100644 --- a/src/mex.c +++ b/src/mex.c @@ -13,17 +13,11 @@ dump_line(const char *line, size_t len) for (size_t i = 0; i < LINE_LEN; ++i) { /* Add padding if needed */ - if (i >= (len*BYTE_COUNT)+1) { - printf(" "); - continue; - } - - if (i >= len) { - /* Don't print any more bytes */ - continue; + if (i < len) { + printf("%02X", line[i] & 0xFF); + } else { + printf(" "); } - - printf("%02X", line[i] & 0xFF); if (((i + 1) % BYTE_COUNT) == 0) { printf(" "); } -- cgit v1.2.3