[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] bitops: unify bitops_flsl with host-utils.h, ca
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] bitops: unify bitops_flsl with host-utils.h, call it bitops_clzl |
Date: |
Mon, 04 Feb 2013 11:36:16 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 02/04/2013 11:26 AM, Richard Henderson wrote:
> Similar to the bitops_ctz change just made.
>
> Signed-off-by: Richard Henderson <address@hidden>
> ---
> include/qemu/bitops.h | 44 +++++++++++++++-----------------------------
> target-i386/topology.h | 2 +-
> util/bitops.c | 2 +-
> 3 files changed, 17 insertions(+), 31 deletions(-)
Reviewed-by: Eric Blake <address@hidden>
>
> diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h
> index 8b88791..07ada63 100644
> --- a/include/qemu/bitops.h
> +++ b/include/qemu/bitops.h
> @@ -50,41 +50,27 @@ static unsigned long bitops_ctzl(unsigned long word)
> }
>
> /**
> - * bitops_fls - find last (most-significant) set bit in a long word
> + * bitops_clzl - find last (most-significant) set bit in a long word
> * @word: the word to search
> *
> * Undefined if no set bit exists, so code should check against 0 first.
Interesting that you chose to leave 0 undefined here, even though
bitops_ctzl specifically defines that case, but not a show-stopper. Per
Paolo's arguments in the other thread, if we did decide to define
bitops_clzl(0), setting it to the word size would be a reasonable choice
(bitops_clzl(2)=>62, bitops_clzl(1)=>63, bitops_clzl(0)=>64), but that
can be done later if it turns out to be useful.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature