File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -177,14 +177,15 @@ void dbgPrintVersion(void)
177177void dbgDumpMemory (void const *buf, uint8_t size, uint16_t count, bool printOffset)
178178{
179179 uint8_t const *buf8 = (uint8_t const *) buf;
180+
181+ uint8_t format_size = 2 * size;
182+ if ( count*size > UINT8_MAX ) offset_fmt_size *= 2 ;
183+ if ( count*size > UINT16_MAX ) offset_fmt_size *= 2 ;
180184
181- char format[] = " %00lX" ;
182- format[2 ] += 2 *size;
185+ char format[] = " %02lX" ;
183186
184- char offset_fmt[] = " %02lX: " ;
185-
186- if ( count*size > UINT8_MAX ) format[2 ] *= 2 ;
187- if ( count*size > UINT16_MAX ) format[2 ] *= 2 ;
187+ char offset_fmt[] = " %00lX: " ;
188+ offset_fmt[2 ] += offset_fmt_size;
188189
189190 const uint8_t item_per_line = 16 / size;
190191
You can’t perform that action at this time.
0 commit comments