Adam Martinson amartinson@codeweavers.com writes:
@@ -236,7 +241,40 @@ extern int getopt_long_only (int ___argc, char *const *___argv, #endif /* HAVE_GETOPT_LONG */
#ifndef HAVE_FFS -int ffs( int x );
- #if defined(__i386__) || defined(__x86_64__)
#define HAVE_FFSstatic inline int ffs( int x ){if (!x){return 0;}else{int ret;__asm__("bsfl %1, %0; incl %0" : "=r" (ret) : "r" (x));return ret;}}- #elif defined(__GNUC__) && GCC_VERSION >= 29503
#define HAVE_FFS#define ffs(x) __builtin_ffs(x)- #else
int ffs( int x );- #endif
+#endif
You'd have to show benchmarks to prove that this complexity is necessary. Given that ffs() should already be inlined on all decent platforms, I doubt you'd be able to demonstrate a difference (if anything, your version would be slower because of the extra increment).