Browse Source

Merge pull request #1957 from riscv-software-src/fix-comlog-print-arrays

Let commit_log_print_value print any length byte array
pull/1961/head
Andrew Waterman 1 year ago
committed by GitHub
parent
commit
c2220e6f11
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 9
      riscv/execute.cc

9
riscv/execute.cc

@ -40,13 +40,12 @@ static void commit_log_print_value(FILE *log_file, int width, const void *data)
fprintf(log_file, "0x%016" PRIx64, *(const uint64_t *)data);
break;
default:
// max lengh of vector
if (((width - 1) & width) == 0) {
const uint64_t *arr = (const uint64_t *)data;
if (width % 8 == 0) {
const uint8_t *arr = (const uint8_t *)data;
fprintf(log_file, "0x");
for (int idx = width / 64 - 1; idx >= 0; --idx) {
fprintf(log_file, "%016" PRIx64, arr[idx]);
for (int idx = width / 8 - 1; idx >= 0; --idx) {
fprintf(log_file, "%002" PRIx8, arr[idx]);
}
} else {
abort();

Loading…
Cancel
Save