qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/7] Convert (ffs(val) - 1) to ctz32(val)


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 2/7] Convert (ffs(val) - 1) to ctz32(val)
Date: Tue, 17 Mar 2015 14:54:38 +0000

On Tue, Mar 17, 2015 at 12:09 PM, Peter Maydell
<address@hidden> wrote:
> On 17 March 2015 at 11:56, Stefan Hajnoczi <address@hidden> wrote:
>> This commit was generated mechanically by coccinelle from the following
>> semantic patch:
>>
>> @@
>> expression val;
>> @@
>> - (ffs(val) - 1)
>> + ctz32(val)
>
> Did you check all these callsites to make sure that the value
> passed in can never be zero? (ffs(0) - 1) is -1 whereas
> ctz32(0) is 32...

I have done that now and found 2 cases where it's possible.  They will
be moved to separate patches in v2.

Stefan



reply via email to

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