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

2013-11-14 Thread Paolo Bonzini
Il 14/11/2013 06:51, Alexey Kardashevskiy ha scritto: >> > 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). Wh

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

2013-11-13 Thread Alexey Kardashevskiy
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 wrapp

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

2013-11-13 Thread Paolo Bonzini
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 inst

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

2013-11-12 Thread Alexey Kardashevskiy
On 11/11/2013 10:57 PM, Andreas Färber wrote: > Am 11.11.2013 08:44, schrieb Alexey Kardashevskiy: >> This adds a macro to calculate the highest bit set. > > Isn't that already available as ffs / clz GCC builtin with wrapper in > qemu/bitops.h? What's the difference to your macro? CC'ing Paolo.

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

2013-11-11 Thread Alexey Kardashevskiy
On 11/11/2013 10:57 PM, Andreas Färber wrote: > Am 11.11.2013 08:44, schrieb Alexey Kardashevskiy: >> This adds a macro to calculate the highest bit set. > > Isn't that already available as ffs / clz GCC builtin with wrapper in > qemu/bitops.h? What's the difference to your macro? CC'ing Paolo. >

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

2013-11-11 Thread Andreas Färber
Am 11.11.2013 08:44, schrieb Alexey Kardashevskiy: > This adds a macro to calculate the highest bit set. Isn't that already available as ffs / clz GCC builtin with wrapper in qemu/bitops.h? What's the difference to your macro? CC'ing Paolo. Andreas > If used on constant > values, no code will be

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

2013-11-10 Thread Alexey Kardashevskiy
This adds a macro to calculate the highest bit set. If used on constant values, no code will be generated. Signed-off-by: Alexey Kardashevskiy --- include/qemu/bitops.h | 12 1 file changed, 12 insertions(+) diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h index 304c90c..