#ifndef DEBUG_H #define DEBUG_H #include #include extern FILE *DUMP; /* Define this variable somewhere (eg with DUMP = stderr). */ static inline void debug_dump_lanes(const char *header, size_t len, const uint8_t buf[len], int indent) { fprintf(DUMP, "%s\n", header); for (size_t line=0; line %zu]", line, b, byte_index); */ fprintf(DUMP, "%02x ", buf[byte_index]); } fprintf(DUMP, "\n"); } fprintf(DUMP, "\n"); } static inline void debug_open_dump(const char *suite, const char *vector_name) { size_t namelen = snprintf(NULL, 0, "results/traces-%s-%s.txt", suite, vector_name); char name[namelen+1]; snprintf(name, sizeof(name), "results/traces-%s-%s.txt", suite, vector_name); DUMP = fopen(name, "w"); } #endif /* DEBUG_H */