From 8039e2b26aed1ccb7bc94e1abcec5f3164c3a700 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Tue, 28 Dec 2021 15:07:07 +0800 Subject: [PATCH] crc32: define `start_time` when debug is enabled The variable `start_time` indicates when a CRC32 operation began. This variable is used to benchmark the speed of the CRC32 function. Currently, this is tied to `PC_HOSTED`. However, the actual usage is tied to `DEBUG_WARN`. This means that the variable is undefined when `DEBUG_WARN` is defined and we're not configured for `PC_HOSTED` mode. Add macro guards around this variable so that it is defined when debugging is enabled, rather than only when building on `PC_HOSTED`. Signed-off-by: Sean Cross --- src/crc32.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/crc32.c b/src/crc32.c index a56b9944..8ce25dff 100644 --- a/src/crc32.c +++ b/src/crc32.c @@ -106,9 +106,11 @@ int generic_crc32(target *t, uint32_t *crc_res, uint32_t base, size_t len) * 22 s @ 4k and 21 s @ 64k */ uint8_t bytes[0x1000]; - uint32_t start_time = platform_time_ms(); #else uint8_t bytes[128]; +#endif +#if defined(ENABLE_DEBUG) + uint32_t start_time = platform_time_ms(); #endif uint32_t last_time = platform_time_ms(); while (len) {