wineport: Add support for ctz().

Alexandre Julliard julliard at winehq.org
Wed Mar 16 08:34:08 CDT 2011


Adam Martinson <amartinson at 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 at winehq.org



More information about the wine-devel mailing list