[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] bitops: unify bitops_ffsl with the one in ho
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2] bitops: unify bitops_ffsl with the one in host-utils.h, using __builtin_ffsl |
Date: |
Wed, 30 Jan 2013 11:03:02 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
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 <address@hidden>
> ---
> 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
signature.asc
Description: OpenPGP digital signature