On 08/11/2012 04:23 AM, Ondřej Bílka wrote:
>>
>> Did you consider using a variant of the following?
>> It looks like it would be more efficient.

The fallback code is only for non-gcc compilation in the first place,
but yes, the de Bruijn table lookup does seem nicer; I'll switch over to
using it.

> Currently fastest way is convert to float and extract exponent. This is
> always log2(n) or log2(n)+1 which can be easily repaired.

Unfortunately, your implementation is not portable.  Gnulib can't afford
to make assumptions about the layout of a floating point number, even if
it holds true for most platforms with IEEE doubles.

-- 
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to