From patchwork Fri Jun 26 14:49:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 488893 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1CBC4140081 for ; Sat, 27 Jun 2015 01:16:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=JU7tS6oi; dkim-atps=neutral Received: from localhost ([::1]:60647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8VMb-0006z2-5J for incoming@patchwork.ozlabs.org; Fri, 26 Jun 2015 11:16:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Uy5-0005B8-WC for qemu-devel@nongnu.org; Fri, 26 Jun 2015 10:51:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8Uy1-0002M9-2r for qemu-devel@nongnu.org; Fri, 26 Jun 2015 10:51:01 -0400 Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]:33564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Uy0-0002Lz-HH for qemu-devel@nongnu.org; Fri, 26 Jun 2015 10:50:56 -0400 Received: by qkhu186 with SMTP id u186so56280983qkh.0 for ; Fri, 26 Jun 2015 07:50:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=uSoxHNpN81GtIJfEG1Q8FYwD67d3izanQEuL3G+2XzY=; b=JU7tS6oissrBwjND3cUVJm5HLL2OGuOFbeOJN1gQfnCj7nV1fyKW5qpN5m3wt2Ms3C feKl40IrDipe+3sATpvUR7jST+UTwhpSAbJKchuFKAPpbMOZ/r5gloalOdvwwlT+LkGo bH/VoY8nR1jJNs2lhsTI+1W0+F0dj3b6egbcPn3JPEAJEB5wAa0VcFqjHoQnQ55TOmiV 6aWty2R+l8VJ/tACXejNNfAebMvc3KqAKNK8o3ra+6JPR7VFJsCacW6vSnWzz6OnI6Lb H2DLgOx5Rb+yrSkp9reG12esLc6Qf8+irPunu9U3kDPhiEgTxW4MV2FG4t19XWUnORrn uTjQ== X-Received: by 10.55.15.144 with SMTP id 16mr4473161qkp.98.1435330256172; Fri, 26 Jun 2015 07:50:56 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by mx.google.com with ESMTPSA id 6sm6940340qkx.38.2015.06.26.07.50.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 07:50:55 -0700 (PDT) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 26 Jun 2015 16:49:27 +0200 Message-Id: <1435330185-23248-22-git-send-email-marcandre.lureau@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1435330185-23248-1-git-send-email-marcandre.lureau@gmail.com> References: <1435330185-23248-1-git-send-email-marcandre.lureau@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c09::231 Cc: cam@cs.ualberta.ca, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , stefanha@redhat.com Subject: [Qemu-devel] [PATCH 21/39] ivshmem: use common is_power_of_2() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 8fcdd60..34da11a 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) { @@ -631,7 +627,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; }