Skip to content

Commit 02c79ff

Browse files
committed
It’s the offset, not the data, that adusts to size
1 parent 23f88ea commit 02c79ff

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cores/nRF5/debug.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ void dbgDumpMemory(void const *buf, uint8_t size, uint16_t count, bool printOffs
179179
uint8_t const *buf8 = (uint8_t const *) buf;
180180

181181
uint8_t format_size = 2 * size;
182-
if ( count*size > UINT8_MAX ) format_size *= 2;
183-
if ( count*size > UINT16_MAX ) format_size *= 2;
182+
if ( count*size > UINT8_MAX ) offset_fmt_size *= 2;
183+
if ( count*size > UINT16_MAX ) offset_fmt_size *= 2;
184184

185-
char format[] = "%00lX";
186-
format[2] += format_size;
185+
char format[] = "%02lX";
187186

188-
char offset_fmt[] = "%02lX: ";
187+
char offset_fmt[] = "%00lX: ";
188+
offset_fmt[2] += offset_fmt_size;
189189

190190
const uint8_t item_per_line = 16 / size;
191191

0 commit comments

Comments
 (0)