All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Gabriel Paubert <paubert@iram.es>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [2.6.6-BK] x86_64 has buggy ffs() implementation
Date: Wed, 12 May 2004 15:29:08 -0700	[thread overview]
Message-ID: <40A2A534.9080004@zytor.com> (raw)
In-Reply-To: <20040512211124.GA6005@iram.es>

Gabriel Paubert wrote:
> 
> Either I'm asleep or you are emulating bsrl, not bsfl. It
> should rather be:
> 
> 	if ( y & 0x00000001) return 1;
> 	if ( y & 0x00000002) return 2;
> 	if ( y & 0x00000004) return 3;
> 	...
> 	if ( y & 0x80000000) return 32;
> 	return 0;
> 
> No need for the else clauses either because of the return.
> But maybe even __builtin_ffs(y) would work in this case.
> 

If __builtin_ffs() works *AND HAS THE RIGHT SEMANTICS* it's probably the 
best thing to use.

Otherwise, yes, generic_ffs() can clearly be used inside the 
__builtin_constant_p() clause.

	-hpa

      reply	other threads:[~2004-05-12 22:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-12 13:43 [2.6.6-BK] x86_64 has buggy ffs() implementation Anton Altaparmakov
2004-05-12 14:02 ` Andi Kleen
2004-05-12 20:31 ` H. Peter Anvin
2004-05-12 21:08   ` Anton Altaparmakov
2004-05-12 21:11   ` Gabriel Paubert
2004-05-12 22:29     ` H. Peter Anvin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40A2A534.9080004@zytor.com \
    --to=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paubert@iram.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.