public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: David Howells <dhowells@redhat.com>
Cc: linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Dmitry Kasatkin <dmitry.kasatkin@intel.com>
Subject: Re: [PATCH] MPILIB: Provide count_leading/trailing_zeros() based on arch functions
Date: Fri, 20 Jul 2012 22:02:28 +0000	[thread overview]
Message-ID: <201207202202.28723.arnd@arndb.de> (raw)
In-Reply-To: <5723.1342794099@warthog.procyon.org.uk>

On Friday 20 July 2012, David Howells wrote:
> 
> Arnd Bergmann <arnd@arndb.de> wrote:
> 
> > I don't generally like to put stuff into asm-generic when it's unlikely
> > to be overridden by architectures. It would really belong into
> > include/linux, but then again we have all the other bitops in asm-generic
> > as well, so whatever...
> 
> Some arches (such as Sparc, I think) have count-leading-zero instructions.

But I guess they would still use the same definition of

+static inline int count_leading_zeros(unsigned long x)
+{
+       if (sizeof(x) == 4)
+               return BITS_PER_LONG - fls(x);
+       else
+               return BITS_PER_LONG - fls64(x);
+}

and just provide their own fls().

	Arnd

  reply	other threads:[~2012-07-21  8:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20 12:56 [PATCH] MPILIB: Provide count_leading/trailing_zeros() based on arch functions David Howells
2012-07-20 13:53 ` Arnd Bergmann
2012-07-20 14:21   ` David Howells
2012-07-20 22:02     ` Arnd Bergmann [this message]
2012-07-21  0:46     ` David Miller
2012-08-10 12:51       ` Jan Engelhardt
2012-08-10 21:08         ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2012-07-06 15:45 David Howells
2012-07-13  4:04 ` James Morris

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=201207202202.28723.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=dmitry.kasatkin@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox