diff --git a/src/util/math.h b/src/util/math.h index 31709e20a..654d44517 100644 --- a/src/util/math.h +++ b/src/util/math.h @@ -16,6 +16,9 @@ static inline uint32_t popcount32(unsigned bits) { static inline unsigned clz32(uint32_t bits) { #if defined(__GNUC__) || __clang__ + if (!bits) { + return 32; + } return __builtin_clz(bits); #else static const int table[256] = {