diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-07-05 14:28:17 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-07-05 14:28:17 +0200 |
| commit | 75d7f59658539c699cdf9c7a3abdbead15aac199 (patch) | |
| tree | 7bd7b860ab8e60105e37c873d134b2d59842b21e /test/debug.h | |
| parent | 3d4608aac686498fa6a84f71dee05dadfd057dc9 (diff) | |
| parent | c242f47057cd3fdeb4471655b4cbd8c870fcf597 (diff) | |
| download | lilliput-ae-implem-75d7f59658539c699cdf9c7a3abdbead15aac199.tar.xz | |
Merge branch 'fix-concatenation'
Diffstat (limited to 'test/debug.h')
| -rw-r--r-- | test/debug.h | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/test/debug.h b/test/debug.h index 24b7787..56cd123 100644 --- a/test/debug.h +++ b/test/debug.h @@ -17,9 +17,7 @@ static inline void debug_dump_lanes(const char *header, size_t len, const uint8_ fprintf(DUMP, "%*s", indent, ""); for (size_t b=0; b<8; b++) { - /* start with MSB */ - size_t byte_index = len-(1+line*8+b); - fprintf(DUMP, "%*s%02x", 5, "", buf[byte_index]); + fprintf(DUMP, "%*s%02x", 5, "", buf[line*8+b]); } fprintf(DUMP, "\n"); } @@ -30,26 +28,24 @@ static inline void debug_dump_buffer(const char *header, size_t len, const uint8 { fprintf(DUMP, "%*s%s\n", indent, "", header); - if (len%8 != 0) + for (size_t line=0; line<len/8; line++) { - fprintf(DUMP, "%*s", (int)(3*(8-len%8))+indent, ""); - for (size_t b=0; b<len%8; b++) + fprintf(DUMP, "%*s[0x%02zx] ", indent, "", line*8); + for (size_t b=0; b<8; b++) { - size_t byte_index = len-1-b; - fprintf(DUMP, "%02x ", buf[byte_index]); + /* fprintf(DUMP, "[%zu / %zu => %zu]", line, b, line*8+b); */ + fprintf(DUMP, "%02x ", buf[line*8+b]); } fprintf(DUMP, "\n"); } - for (size_t line=0; line<len/8; line++) + size_t rest = len%8; + if (rest != 0) { - fprintf(DUMP, "%*s", indent, ""); - for (size_t b=0; b<8; b++) + fprintf(DUMP, "%*s[0x%02zx] ", indent, "", len-rest); + for (size_t b=0; b<rest; b++) { - /* start with MSB */ - size_t byte_index = 8*(len/8 - 1 - line) + 7-b; - /* fprintf(DUMP, "[%zu / %zu => %zu]", line, b, byte_index); */ - fprintf(DUMP, "%02x ", buf[byte_index]); + fprintf(DUMP, "%02x ", buf[len-rest+b]); } fprintf(DUMP, "\n"); } |
