On 01/30/2013 10:57 AM, Paolo Bonzini wrote:
> Fixes the build on Mac OS X, which has ffsl.
> 
> Signed-off-by: Paolo Bonzini <[email protected]>
> ---
>  include/qemu/bitops.h     | 40 ++++++++++++++--------------------------
>  include/qemu/hbitmap.h    |  2 +-
>  include/qemu/host-utils.h | 25 -------------------------
>  util/hbitmap.c            |  2 +-
>  4 files changed, 16 insertions(+), 53 deletions(-)
> 
> diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h
> index 74e14e5..27b2d42 100644
> --- a/include/qemu/bitops.h
> +++ b/include/qemu/bitops.h
> @@ -13,6 +13,7 @@
>  #define BITOPS_H
>  
>  #include "qemu-common.h"
> +#include "host-utils.h"
>  
>  #define BITS_PER_BYTE           CHAR_BIT
>  #define BITS_PER_LONG           (sizeof (unsigned long) * BITS_PER_BYTE)
> @@ -30,34 +31,21 @@
>   */
>  static unsigned long bitops_ffsl(unsigned long word)
>  {
> -     int num = 0;
> +#if QEMU_GNUC_PREREQ(3, 4)
> +    return __builtin_ffsl(word) + 1;

Nope.  The +1 is wrong (it was only needed when using __builtin_ctzl()).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to