diff --git a/libretro-common/include/compat/intrinsics.h b/libretro-common/include/compat/intrinsics.h index 51a0ed53d2..0601dffadc 100644 --- a/libretro-common/include/compat/intrinsics.h +++ b/libretro-common/include/compat/intrinsics.h @@ -57,23 +57,17 @@ static INLINE unsigned compat_clz_u16(uint16_t val) } /* Count Trailing Zero */ +static INLINE int compat_ctz(unsigned x) +{ #if defined(__GNUC__) && !defined(RARCH_CONSOLE) -static INLINE int compat_ctz(unsigned x) -{ return __builtin_ctz(x); -} #elif _MSC_VER >= 1400 -static INLINE int compat_ctz(unsigned x) -{ unsigned long r = 0; _BitScanReverse((unsigned long*)&r, x); return (int)r; -} #else /* Only checks at nibble granularity, * because that's what we need. */ -static INLINE int compat_ctz(unsigned x) -{ if (x & 0x000f) return 0; if (x & 0x00f0) @@ -83,8 +77,8 @@ static INLINE int compat_ctz(unsigned x) if (x & 0xf000) return 12; return 16; -} #endif +} RETRO_END_DECLS