From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Howells Subject: Re: Arch maintainers Ahoy! Date: Thu, 24 May 2012 17:45:29 +0100 Message-ID: <14266.1337877929@redhat.com> References: <20120523.132109.1153947222019508621.davem@davemloft.net> <20120523.141647.2252460119413470634.davem@davemloft.net> <32064.1337852416@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mx1.redhat.com ([209.132.183.28]:17018 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933508Ab2EXQpj convert rfc822-to-8bit (ORCPT ); Thu, 24 May 2012 12:45:39 -0400 In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: dhowells@redhat.com, David Miller , James.Bottomley@hansenpartnership.com, geert@linux-m68k.org, linux-arch@vger.kernel.org Linus Torvalds wrote: > > Could you use cpu_to_be32/64() and then ffs()? =C2=A0That ought to = work for both > > variants of endianness. =C2=A0The cpu_to_beXX() should be a noop on= BE and is > > likely to be a single instruction on LE. =C2=A0The meat of ffs() is= usually a > > single instruction, though it may have to have zero-detect logic ad= ded. >=20 > First off, the *last* thing you want to do is go to big-endian mode. > All the bit counting gets *much* more complicated, and your argument > that it's "free" on some architectures is pointless, since it is only > free on the architectures that have the *least* users. I didn't suggest it was free, but it might be cheaper. Besides x86/x86= _64 has BSF/BSR instructions - though having played with Dave's algorithm some,= I don't think they're usable for this. My suggestion assumes that there would be zeros beyond the terminal NUL= , which isn't something you can rely on. David