From acf76f6a58d84922bf9f9a558999c993129b8f4b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 19 Aug 2016 20:18:04 +0200 Subject: [PATCH] (libretro-common) Simplify compat_ctz --- libretro-common/include/compat/intrinsics.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) 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