16 Mar
2011
16 Mar
'11
1:34 p.m.
Adam Martinson <amartinson(a)codeweavers.com> writes:
@@ -239,6 +243,19 @@ extern int getopt_long_only (int ___argc, char *const *___argv, int ffs( int x ); #endif
+#if defined(__GNUC__) && (GCC_VERSION >= 30406) + #define ctz(x) __builtin_ctz(x) +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + static inline int ctz( unsigned int x ) + { + int ret; + __asm__("bsfl %1, %0" : "=r" (ret) : "r" (x)); + return ret; + } +#else + #define ctz(x) (ffs(x)-1) +#endif
There's no reason to add this. Just use ffs(). -- Alexandre Julliard julliard(a)winehq.org