mirror of https://github.com/mgba-emu/mgba.git
Util: Make clz consistent
This commit is contained in:
parent
874fae7b5a
commit
f7d17d62b5
|
@ -18,6 +18,9 @@ static inline uint32_t popcount32(unsigned bits) {
|
||||||
|
|
||||||
static inline unsigned clz32(uint32_t bits) {
|
static inline unsigned clz32(uint32_t bits) {
|
||||||
#if defined(__GNUC__) || __clang__
|
#if defined(__GNUC__) || __clang__
|
||||||
|
if (!bits) {
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
return __builtin_clz(bits);
|
return __builtin_clz(bits);
|
||||||
#else
|
#else
|
||||||
static const int table[256] = {
|
static const int table[256] = {
|
||||||
|
|
Loading…
Reference in New Issue