Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 2015 10:59:01 -0400
From:      Richard Yao <ryao@gentoo.org>
To:        Ian Lepore <ian@freebsd.org>
Cc:        Erich Dollansky <erichsfreebsdlist@alogt.com>,  "freebsd-hackers@freebsd.org" <freebsd-hackers@FreeBSD.org>
Subject:   Re: allow ffs & co. a binary search
Message-ID:  <5579A235.80609@gentoo.org>
In-Reply-To: <1434034373.1415.3.camel@freebsd.org>
References:  <20150607081315.7c0f09fb@B85M-HD3-0.alogt.com>	 <5579A016.4040800@gentoo.org> <1434034373.1415.3.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 06/11/2015 10:52 AM, Ian Lepore wrote:
> On Thu, 2015-06-11 at 10:49 -0400, Richard Yao wrote:
>> On 06/06/2015 08:13 PM, Erich Dollansky wrote:
> [...]
>>
>> The fastest portable way of calculating highest bit set is to use a
>> debrujin sequence:
>>
>> https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn
>>
>> The binary approach is inferior, especially on Pentium 4 processors.
> 
> And of course it's crucial that we optimize for Pentium 4 processors in
> 2015.

The debrujin approach is fast regardless of the architecture. Anyway,
this is a solved problem. There is no need to reinvent the wheel when
the portable solutions are listed on that page at Stanford.


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJVeaI6AAoJECDuEZm+6Exk9AgQAJfN9OjSLJyOQF+HSRWfjXRw
Nz3eX1Hn83PrjvJUUFBxDFqTQQYycjgAAk/vbqCuy/hflRakdlAclXuP+ZiW6y5C
eMo9sV8LtaBFqZ45ACrRCFno/gSEq/OWgSa7/EhBiRHBfu0k0x8xJbZMdT1ZPzQM
yGG4+DIBQtXj42KzKjYIXs3QRepff3qMXAi/78ksmd5PZ7jNa1x1LTe+qZJP4hUC
OJ/2XR6VRD/fLXGzfxgAjZS9Y1f2mno1oxPm91CntnpLPAyBVR/CWCBeCUADcM0E
nycezA5h0pUU/53ayWe+TUc9dmKEBQ4SKXdi1PBGK4mBzoDvesQDV9aEq8ujTR3x
eHxAOA897No5MrpFBCbE5MwDLYcZFoWY9owBYIuHXCIKBFfXr+GXu7pY6dGIvEKg
p8GUk84Y+cvHLSzXbZHJru8YCKUBLsgUMZCKwLMHqeTCLa3oW455hFjombtvVwJ7
FuQV10+BZ8exI14SeyyZfrQJnPeLhS//HWobYq6AL9xLDVmXVf9qP3+U6g8eisyo
xHBOL6ZhEHHyIiLISJL4YYAyZzk3Sr843FuEfIr+j6dqO6wlBmuWY3NlsiL3lotN
Mb3lorTn4j4LOth3R8C/S5rfWgqpYUXzN77rGUunXcQU4u3Q6fxLp4HpQyK8+CdG
/xZwTAbNIawevTIUViey
=oPoC
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5579A235.80609>