[Top][All Lists]

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

Re: [PATCH] count-leading-zeros: new module

From: Eric Blake
Subject: Re: [PATCH] count-leading-zeros: new module
Date: Sat, 11 Aug 2012 07:16:15 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0

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   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]