From 11b8e0d9be990e41cb651c2e394fdff0a151ad64 Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Mon, 13 Jul 2020 15:20:49 +0200 Subject: [PATCH] Per bytes error highlighting --- examples/headless/main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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) { -- 2.30.2