diff options
author | Ian Moffett <industrial.reformer@gmail.com> | 2024-04-12 21:58:51 -0400 |
---|---|---|
committer | Ian Moffett <industrial.reformer@gmail.com> | 2024-04-12 21:58:51 -0400 |
commit | 7c2a57616adad4d5600018af44a438c7659aa086 (patch) | |
tree | 07394529dbbd500232cac85cc13acb030b6b658e | |
parent | 7b64f72af9422ad5030307a02041f9ed6be060b1 (diff) |
Fix padding
Signed-off-by: Ian Moffett <industrial.reformer@gmail.com>
-rw-r--r-- | src/mex.c | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -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(" "); } |