qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 5/6] bitops: add BITNR macro


From: Alexey Kardashevskiy
Subject: Re: [Qemu-devel] [PATCH v3 5/6] bitops: add BITNR macro
Date: Thu, 14 Nov 2013 16:51:55 +1100
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

On 11/13/2013 11:04 PM, Paolo Bonzini wrote:
> Il 13/11/2013 03:40, Alexey Kardashevskiy ha scritto:
>> I looked further and did not find any use of ffs/clz so I wonder what did
>> you mean about bitops.h and what did I miss? I am confused.
> 
> It's host-utils.h actually.  The reason for the wrappers is twofold:
> 
> (1) provide 32/64-bit functions instead of int/long/longlong;
> 
> (2) support GCC <3.4.
> 
> The wrappers are not usable where you have constant expressions as in
> your case.  So your original patch is good IMO, except for the __ at the
> beginning of __BITNR.


There are 2 macros, one (BITNR) uses the other (__BITNR). What would the
good name be for BITNR then?


> 
> Paolo
> 
>> So I would suggest the following instead (if I really needed this BITNR but
>> I really do not :) )
>>
>> ===
>>     bitops: add BITNR macro
>>
>>     This adds a macro to calculate the highest single bit set. If more than
>>     one bit is set, returns -1.
> 


-- 
Alexey



reply via email to

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