It’s the offset, not the data, that adusts to size

This commit is contained in:
Ben Artin committed 2018-08-20 21:44:28 -04:00
1 parent 23f88ea19b
commit 02c79ffe1f
1 file changed
+5 -5
+5 -5
View File
@@ -179,13 +179,13 @@ void dbgDumpMemory(void const *buf, uint8_t size, uint16_t count, bool printOffs
uint8_t const *buf8 = (uint8_t const *) buf;
uint8_t format_size = 2 * size;
if ( count*size > UINT8_MAX ) format_size *= 2;
if ( count*size > UINT16_MAX ) format_size *= 2;
if ( count*size > UINT8_MAX ) offset_fmt_size *= 2;
if ( count*size > UINT16_MAX ) offset_fmt_size *= 2;
char format[] = "%00lX";
format[2] += format_size;
char format[] = "%02lX";
char offset_fmt[] = "%02lX: ";
char offset_fmt[] = "%00lX: ";
offset_fmt[2] += offset_fmt_size;
const uint8_t item_per_line = 16 / size;