On 03/17/2011 02:04 PM, Alexander Kochetkov wrote:
For my purposes the 'return -1' path will never be taken, so it's not
needed. I want to be able to do:
while (bitmap)
{
i = ctz(bitmap); /* get the LSB index */
bitmap ^= 1<< i; /* zero LSB */
/* for each set bit i... */
}
If the
On 03/17/2011 02:54 AM, Marcus Meissner wrote:
On Wed, Mar 16, 2011 at 01:26:31PM -0500, Adam Martinson wrote:
On 03/16/2011 08:34 AM, Alexandre Julliard wrote:
Adam Martinson writes:
@@ -239,6 +243,19 @@ extern int getopt_long_only (int ___argc, char *const
*___argv,
int ffs( int x );
On 03/17/2011 03:23 AM, David Laight wrote:
On Wed, Mar 16, 2011 at 01:26:31PM -0500, Adam Martinson wrote:
__builtin_ctz() compiles to:
mov0x8(%ebp),%eax
bsf%eax,%eax
(ffs()-1) compiles to:
mov$0x,%edx
bsf0x8(%ebp),%eax
cmove %edx,%eax
...
So yes, there is a reason,
On Wed, Mar 16, 2011 at 01:26:31PM -0500, Adam Martinson wrote:
>
> __builtin_ctz() compiles to:
> mov0x8(%ebp),%eax
> bsf%eax,%eax
>
> (ffs()-1) compiles to:
> mov$0x,%edx
> bsf0x8(%ebp),%eax
> cmove %edx,%eax
...
>
> So yes, there is a reason, ctz() is at least 50% fas
On Wed, Mar 16, 2011 at 01:26:31PM -0500, Adam Martinson wrote:
> On 03/16/2011 08:34 AM, Alexandre Julliard wrote:
> >Adam Martinson writes:
> >
> >>@@ -239,6 +243,19 @@ extern int getopt_long_only (int ___argc, char *const
> >>*___argv,
> >> int ffs( int x );
> >> #endif
> >>
> >>+#if defined
On 03/16/2011 08:34 AM, Alexandre Julliard wrote:
Adam Martinson 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(__GNU
Adam Martinson 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