Re: [Qemu-devel] [PATCH] bitops: unify bitops_ffsl with the one in host-utils.h

2013-01-30 Thread Peter Maydell
On 30 January 2013 21:51, Eric Blake wrote: > On 01/30/2013 01:41 PM, Peter Maydell wrote: >> This reimplementation appears to have an off by one error. >> For example, on an input of 4, the old algorithm returns 2 >> and this one returns 3. > > Ouch - you are right that the old implementation is

Re: [Qemu-devel] [PATCH] bitops: unify bitops_ffsl with the one in host-utils.h

2013-01-30 Thread Eric Blake
On 01/30/2013 01:41 PM, Peter Maydell wrote: >> -#if LONG_MAX > 0x7FFF >> - if ((word & 0x) == 0) { >> - num += 32; >> - word >>= 32; >> - } >> - if ((word & 0x) == 0) { >> - num += 16; >> - word >>= 16; >>

Re: [Qemu-devel] [PATCH] bitops: unify bitops_ffsl with the one in host-utils.h

2013-01-30 Thread Peter Maydell
On 30 January 2013 16:53, Paolo Bonzini wrote: > +if (!word) { > +return 0; > +} If we're specifically defining the behaviour for zero input we need to fix the API documentation comment which currently says this case is undefined and the caller should be checking. > -#if LONG_MAX

Re: [Qemu-devel] [PATCH] bitops: unify bitops_ffsl with the one in host-utils.h

2013-01-30 Thread Peter Maydell
On 30 January 2013 16:53, Paolo Bonzini wrote: > Fixes the build on Mac OS X, which has ffsl. > > Signed-off-by: Paolo Bonzini Confirmed that this fixes the MacOSX build (though there seems to be some other problem causing us to hang on startup which I need to track down). NB: the comment in ho

Re: [Qemu-devel] [PATCH] bitops: unify bitops_ffsl with the one in host-utils.h

2013-01-30 Thread Stefan Weil
o 2013 18:36:52 >> Oggetto: Re: [Qemu-devel] [PATCH] bitops: unify bitops_ffsl with the one in >> host-utils.h >> >> Am 30.01.2013 17:53, schrieb Paolo Bonzini: >>> Fixes the build on Mac OS X, which has ffsl. >>> >>> Signed-off-by: Paolo Bonzini

Re: [Qemu-devel] [PATCH] bitops: unify bitops_ffsl with the one in host-utils.h

2013-01-30 Thread Richard Henderson
On 01/30/2013 09:46 AM, Paolo Bonzini wrote: >Nevertheless I wonder why you don't use gcc's __builtin_ffsl. Because I had no idea it existed until now. :) Do you know what version of GCC introduced it? gcc 3.4. 2003-02-01 Falk Hueffner * optabs.h (optab_index): Add OTI_clz, OTI_c

Re: [Qemu-devel] [PATCH] bitops: unify bitops_ffsl with the one in host-utils.h

2013-01-30 Thread Paolo Bonzini
- Messaggio originale - > Da: "Stefan Weil" > A: "Paolo Bonzini" > Cc: qemu-devel@nongnu.org, blauwir...@gmail.com, "peter maydell" > > Inviato: Mercoledì, 30 gennaio 2013 18:36:52 > Oggetto: Re: [Qemu-devel] [PATCH] bitops: unify bit

Re: [Qemu-devel] [PATCH] bitops: unify bitops_ffsl with the one in host-utils.h

2013-01-30 Thread Eric Blake
On 01/30/2013 09:53 AM, Paolo Bonzini wrote: > Fixes the build on Mac OS X, which has ffsl. > > Signed-off-by: Paolo Bonzini > --- > include/qemu/bitops.h | 40 ++-- > include/qemu/hbitmap.h| 2 +- > include/qemu/host-utils.h | 25

Re: [Qemu-devel] [PATCH] bitops: unify bitops_ffsl with the one in host-utils.h

2013-01-30 Thread Stefan Weil
Am 30.01.2013 17:53, schrieb Paolo Bonzini: > Fixes the build on Mac OS X, which has ffsl. > > Signed-off-by: Paolo Bonzini > --- > include/qemu/bitops.h | 40 ++-- > include/qemu/hbitmap.h| 2 +- > include/qemu/host-utils.h | 25 --

[Qemu-devel] [PATCH] bitops: unify bitops_ffsl with the one in host-utils.h

2013-01-30 Thread Paolo Bonzini
Fixes the build on Mac OS X, which has ffsl. Signed-off-by: Paolo Bonzini --- include/qemu/bitops.h | 40 ++-- include/qemu/hbitmap.h| 2 +- include/qemu/host-utils.h | 25 - util/hbitmap.c| 2 +- 4 files changed,