[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 067/107] ppc: Fix a warning in bcdcfz code and improve
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 067/107] ppc: Fix a warning in bcdcfz code and improve BCD_DIG_BYTE macro |
Date: |
Thu, 2 Feb 2017 16:14:05 +1100 |
From: Jose Ricardo Ziviani <address@hidden>
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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
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 81f134b..8cf4ee3 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -2551,9 +2551,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)
@@ -2876,7 +2876,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;
--
2.9.3
- [Qemu-ppc] [PULL 034/107] ppc: Rewrite ppc_set_compat(), (continued)
- [Qemu-ppc] [PULL 034/107] ppc: Rewrite ppc_set_compat(), David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 051/107] target-ppc: Use float64 arg in helper_compute_fprf(), David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 047/107] target-ppc: Add xxinsertw instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 026/107] target-ppc: Add xxperm and xxpermr instructions, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 059/107] target-ppc: Add xsxsigqp instructions, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 028/107] target-ppc: implement lxvll instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 042/107] hw/gpio: QOM'ify mpc8xxx.c, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 066/107] ppc: Prevent inifnite loop in decrementer auto-reload., David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 069/107] softfloat: Fix the default qNAN for target-ppc, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 049/107] prep: add IBM RS/6000 7020 (40p) memory controller, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 067/107] ppc: Fix a warning in bcdcfz code and improve BCD_DIG_BYTE macro,
David Gibson <=
- [Qemu-ppc] [PULL 029/107] target-ppc: implement stxvl instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 043/107] hw/ppc: QOM'ify e500.c, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 035/107] ppc: Rewrite ppc_get_compat_smt_threads(), David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 030/107] target-ppc: implement stxvll instructions, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 046/107] target-ppc: Add xxextractuw instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 040/107] qtest: convert ivshmem-test to use libqos, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 058/107] target-ppc: Add xsxsigdp instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 056/107] target-ppc: Add xsxexpdp instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 041/107] qtest: add ivshmem-test for ppc64, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 048/107] prep: add PReP System I/O, David Gibson, 2017/02/02