Re: Arch maintainers Ahoy!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> > Could you use cpu_to_be32/64() and then ffs()?  That ought to work for both
> > variants of endianness.  The cpu_to_beXX() should be a noop on BE and is
> > likely to be a single instruction on LE.  The meat of ffs() is usually a
> > single instruction, though it may have to have zero-detect logic added.
> 
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux