Fix missing hex string at the last row when data size is a multiple of 16 bytes

This commit is contained in:
ANR2ME committed 2021-04-19 05:48:37 +07:00
1 parent 8e953b2a97
commit 40941b41a4
1 file changed
+3 -1
+3 -1
View File
@@ -207,8 +207,10 @@ void DataToHexString(const char* prefix, uint32_t startAddr, const uint8_t* data
for (size_t j = size; j < padded_size; j++) {
buffer.Printf(" ");
}
}
if (size > 0) {
buffer.Printf(" ");
for (size_t j = size & ~UINT64_C(0xF); j < size; j++) {
for (size_t j = (size - 1ULL) & ~UINT64_C(0xF); j < size; j++) {
buffer.Printf("%c", ((data[j] < 0x20) || (data[j] > 0x7e)) ? 0x2e : data[j]);
}
}