From patchwork Thu Jan 12 02:03:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 714112 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 3tzVVq54h9z9sdn for ; Thu, 12 Jan 2017 13:45:39 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="GlxXfmqY"; dkim-atps=neutral Received: from localhost ([::1]:58902 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRVOT-0004YL-BG for incoming@patchwork.ozlabs.org; Wed, 11 Jan 2017 21:45:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRUkD-0003F0-Nz for qemu-devel@nongnu.org; Wed, 11 Jan 2017 21:04:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cRUkB-0006ml-Eo for qemu-devel@nongnu.org; Wed, 11 Jan 2017 21:04:01 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:33783) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cRUkA-0006kA-V2; Wed, 11 Jan 2017 21:03:59 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3tzTZN5W0dz9vHK; Thu, 12 Jan 2017 13:03:40 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1484186620; bh=EzxBzTHH8/QwW/2ol0ZEXb/omuNfcaZK2UJmgpnvuWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GlxXfmqY3aS8ZwDJe4jkWOhzms02STU3uojvwVuBaV1v8nrlC60lOES3RWpR53P6D vJz/MlSdrX0hE67NmxPSsjByhKjwohsyifLOa7z3E7eJ2P7L4Q2tAC8Rsvp70Vp+CO AGIXeXeXUQwQx8NzcAkY11kZJ/PgP2Iu4Gz8AJ38= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 12 Jan 2017 13:03:27 +1100 Message-Id: <20170112020327.24882-68-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170112020327.24882-1-david@gibson.dropbear.id.au> References: <20170112020327.24882-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 67/67] ppc: Fix a warning in bcdcfz code and improve BCD_DIG_BYTE macro X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, mdroth@linux.vnet.ibm.com, aik@ozlabs.ru, Jose Ricardo Ziviani , agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Jose Ricardo Ziviani This commit fixes a warning in the code "(i * 2) ? .. : ..", which should be better as "i ? .. : ..", and improves the BCD_DIG_BYTE macro by placing parentheses around its argument to avoid possible expansion issues like: BCD_DIG_BYTE(i + j). Signed-off-by: Jose Ricardo Ziviani Reviewed-by: Eric Blake Signed-off-by: David Gibson --- target/ppc/int_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 24e5964..bd8282c 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2583,9 +2583,9 @@ void helper_vsubecuq(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) #define NATIONAL_NEG 0x2D #if defined(HOST_WORDS_BIGENDIAN) -#define BCD_DIG_BYTE(n) (15 - (n/2)) +#define BCD_DIG_BYTE(n) (15 - ((n) / 2)) #else -#define BCD_DIG_BYTE(n) (n/2) +#define BCD_DIG_BYTE(n) ((n) / 2) #endif static int bcd_get_sgn(ppc_avr_t *bcd) @@ -2908,7 +2908,7 @@ uint32_t helper_bcdcfz(ppc_avr_t *r, ppc_avr_t *b, uint32_t ps) } for (i = 0; i < 16; i++) { - zone_digit = (i * 2) ? b->u8[BCD_DIG_BYTE(i * 2)] >> 4 : zone_lead; + zone_digit = i ? b->u8[BCD_DIG_BYTE(i * 2)] >> 4 : zone_lead; digit = b->u8[BCD_DIG_BYTE(i * 2)] & 0xF; if (unlikely(zone_digit != zone_lead || digit > 0x9)) { invalid = 1;