From 9aa67e58ba449d493c9c9a40f4bb6ea66afa3f45 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Wed, 22 Dec 2021 13:43:17 +1100 Subject: [PATCH] roken: don't call assert() before variable decl --- lib/roken/clz.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/roken/clz.c b/lib/roken/clz.c index 0847b18d5..301ab2778 100644 --- a/lib/roken/clz.c +++ b/lib/roken/clz.c @@ -30,10 +30,15 @@ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_clzll(uint64_t x) { +#if defined(_MSC_VER) + unsigned long r = 0; +#elif !(defined(__GNUC__) && __GNUC__ >= 4) + int r = 0; +#endif + assert(x != 0); #if defined(_MSC_VER) - unsigned long r = 0; # if defined(_WIN64) _BitScanReverse64(&r, x); # else @@ -46,7 +51,6 @@ rk_clzll(uint64_t x) #elif (defined(__GNUC__) && __GNUC__ >= 4) return __builtin_clzll(x); #else - int r = 0; while (!(x & ((uint64_t)1 << 63))) { x <<= 1; ++r;