From: Jean THOMAS Date: Mon, 13 Jul 2020 13:20:49 +0000 (+0200) Subject: Per bytes error highlighting X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=11b8e0d9be990e41cb651c2e394fdff0a151ad64;p=gram.git Per bytes error highlighting --- diff --git a/examples/headless/main.c b/examples/headless/main.c index 0646f3b..06b4ae3 100644 --- a/examples/headless/main.c +++ b/examples/headless/main.c @@ -133,10 +133,13 @@ int main(int argc, char *argv[]) { read_value = gram_read(&ctx, &(ddr[i])); expected_value = 0x12345678 + (1 << 10*i)%0x100000000; - if (read_value != expected_value) { - printf("\033[0;31m%08x\033[0m", read_value); - } else { - printf("\033[0;32m%08x\033[0m", read_value); + + for (int j = 3; j >= 0; j--) { + if (((uint8_t*)(&read_value))[j] != ((uint8_t*)(&expected_value))[j]) { + printf("\033[0;31m%02x\033[0m", ((uint8_t*)(&read_value))[j]); + } else { + printf("\033[0;32m%02x\033[0m", ((uint8_t*)(&read_value))[j]); + } } if ((i % kDumpWidth) == kDumpWidth-1) {