[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 23/31] ppc: use DIV_ROUND_UP
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH 23/31] ppc: use DIV_ROUND_UP |
Date: |
Thu, 22 Jun 2017 14:41:56 +0200 |
I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra
Signed-off-by: Marc-André Lureau <address@hidden>
---
target/ppc/mem_helper.c | 2 +-
target/ppc/translate.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c
index e6383c6bfa..a34e604db3 100644
--- a/target/ppc/mem_helper.c
+++ b/target/ppc/mem_helper.c
@@ -111,7 +111,7 @@ void helper_lswx(CPUPPCState *env, target_ulong addr,
uint32_t reg,
uint32_t ra, uint32_t rb)
{
if (likely(xer_bc != 0)) {
- int num_used_regs = (xer_bc + 3) / 4;
+ int num_used_regs = DIV_ROUND_UP(xer_bc, 4);
if (unlikely((ra != 0 && lsw_reg_in_range(reg, num_used_regs, ra)) ||
lsw_reg_in_range(reg, num_used_regs, rb))) {
raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index c0cd64d927..76f9ccde25 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -2882,7 +2882,7 @@ static void gen_lswi(DisasContext *ctx)
}
if (nb == 0)
nb = 32;
- nr = (nb + 3) / 4;
+ nr = DIV_ROUND_UP(nb, 4);
if (unlikely(lsw_reg_in_range(start, nr, ra))) {
gen_inval_exception(ctx, POWERPC_EXCP_INVAL_LSWX);
return;
--
2.13.1.395.gf7b71de06
- [Qemu-devel] [PATCH 13/31] ui: use DIV_ROUND_UP, (continued)
- [Qemu-devel] [PATCH 13/31] ui: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 14/31] vga: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 15/31] virtio-gpu: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 16/31] monitor: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 17/31] console: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 18/31] virtio-serial: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 19/31] piix: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 20/31] q35: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 21/31] usb-hub: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 22/31] msix: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 23/31] ppc: use DIV_ROUND_UP,
Marc-André Lureau <=
- [Qemu-devel] [PATCH 24/31] i386/dump: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 25/31] kvm: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 26/31] decnumber: use DIV_ROUND_UP, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 27/31] i386: introduce ELF_NOTE_SIZE macro, Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 28/31] 9pfs: replace g_malloc()+memcpy() with g_memdup(), Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 29/31] i386: replace g_malloc()+memcpy() with g_memdup(), Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 30/31] test-iov: replace g_malloc()+memcpy() with g_memdup(), Marc-André Lureau, 2017/06/22
- [Qemu-devel] [PATCH 31/31] eepro100: replace g_malloc()+memcpy() with g_memdup(), Marc-André Lureau, 2017/06/22