[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 67/67] ppc: Fix a warning in bcdcfz code and improve BC
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 67/67] ppc: Fix a warning in bcdcfz code and improve BCD_DIG_BYTE macro |
Date: |
Thu, 12 Jan 2017 13:03:27 +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 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;
--
2.9.3
- [Qemu-ppc] [PULL 20/67] target-ppc: move ppc_vsr_t to common header, (continued)
- [Qemu-ppc] [PULL 20/67] target-ppc: move ppc_vsr_t to common header, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 29/67] target-ppc: implement stxvl instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 45/67] hw/ppc: QOM'ify spapr_vio.c, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 32/67] prep: do not use global variable to access nvram, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 40/67] qtest: convert ivshmem-test to use libqos, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 41/67] qtest: add ivshmem-test for ppc64, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 19/67] ppc/spapr: implement H_SIGNAL_SYS_RESET, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 30/67] target-ppc: implement stxvll instructions, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 26/67] target-ppc: Add xxperm and xxpermr instructions, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 46/67] target-ppc: Add xxextractuw instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 67/67] ppc: Fix a warning in bcdcfz code and improve BCD_DIG_BYTE macro,
David Gibson <=
- [Qemu-ppc] [PULL 52/67] target-ppc: Replace isden by float64_is_zero_or_denormal, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 62/67] ppc: Add ppc_set_compat_all(), David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 64/67] target-ppc: Add xscvdpqp instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 66/67] ppc: Prevent inifnite loop in decrementer auto-reload., David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 55/67] target-ppc: Use correct precision for FPRF setting, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 63/67] target-ppc: Add xsaddqp instructions, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 54/67] target-ppc: Add xscvdphp, xscvhpdp, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 53/67] target-ppc: Rename helper_compute_fprf to helper_compute_fprf_float64, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 48/67] prep: add PReP System I/O, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 17/67] ppc: Clean up and QOMify hypercall emulation, David Gibson, 2017/01/11