From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcAwE-0007GU-Tr for qemu-devel@nongnu.org; Wed, 16 Sep 2015 07:31:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcAw8-0008Im-RR for qemu-devel@nongnu.org; Wed, 16 Sep 2015 07:31:46 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:62112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcAw8-0008IL-Jz for qemu-devel@nongnu.org; Wed, 16 Sep 2015 07:31:40 -0400 References: <1442333283-13119-1-git-send-email-marcandre.lureau@redhat.com> <1442333283-13119-23-git-send-email-marcandre.lureau@redhat.com> From: Claudio Fontana Message-ID: <55F95314.90601@huawei.com> Date: Wed, 16 Sep 2015 13:31:32 +0200 MIME-Version: 1.0 In-Reply-To: <1442333283-13119-23-git-send-email-marcandre.lureau@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v3 22/46] ivshmem: use common is_power_of_2() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org Cc: drjones@redhat.com, cam@cs.ualberta.ca, stefanha@redhat.com On 15.09.2015 18:07, marcandre.lureau@redhat.com wrote: > From: Marc-André Lureau > > The common version correctly checks for 0 value case. > > Signed-off-by: Marc-André Lureau > --- > hw/misc/ivshmem.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c > index e391396..f40bc98 100644 > --- a/hw/misc/ivshmem.c > +++ b/hw/misc/ivshmem.c > @@ -117,10 +117,6 @@ static inline uint32_t ivshmem_has_feature(IVShmemState *ivs, > return (ivs->features & (1 << feature)); > } > > -static inline bool is_power_of_two(uint64_t x) { > - return (x & (x - 1)) == 0; > -} > - > /* accessing registers - based on rtl8139 */ > static void ivshmem_update_irq(IVShmemState *s) > { > @@ -630,7 +626,7 @@ static uint64_t ivshmem_get_size(IVShmemState * s, Error **errp) { > } > > /* BARs must be a power of 2 */ > - if (!is_power_of_two(value)) { > + if (!is_power_of_2(value)) { > error_setg(errp, "size must be power of 2"); > return 0; > } > Reviewed-by: Claudio Fontana