allow ffs & co. a binary search

Richard Yao ryao at gentoo.org
Thu Jun 11 14:59:13 UTC 2015


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20150611/975b8508/attachment.sig>


More information about the freebsd-hackers mailing list