aboutsummaryrefslogtreecommitdiff
path: root/src/mex.c
diff options
context:
space:
mode:
authorIan Moffett <industrial.reformer@gmail.com>2024-04-12 21:58:51 -0400
committerIan Moffett <industrial.reformer@gmail.com>2024-04-12 21:58:51 -0400
commit7c2a57616adad4d5600018af44a438c7659aa086 (patch)
tree07394529dbbd500232cac85cc13acb030b6b658e /src/mex.c
parent7b64f72af9422ad5030307a02041f9ed6be060b1 (diff)
Fix padding
Signed-off-by: Ian Moffett <industrial.reformer@gmail.com>
Diffstat (limited to 'src/mex.c')
-rw-r--r--src/mex.c14
1 files changed, 4 insertions, 10 deletions
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(" ");
}