|
From: | Paolo Bonzini |
Subject: | Re: [Qemu-devel] [PATCH v3 5/6] bitops: add BITNR macro |
Date: | Wed, 13 Nov 2013 13:04:08 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9 |
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. 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.
[Prev in Thread] | Current Thread | [Next in Thread] |