summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2016-05-31 18:36:02 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2016-06-07 18:19:25 +0300
commitb1b2db29bd6c3ed70c29778d8fec0f4bf6ae28ec (patch)
treec8af484d859a7ca88b29eaf304d8867ab6851fb5
parent806956834a898c0d068f116b58e72b0c5e226840 (diff)
downloadfocaccia-qemu-b1b2db29bd6c3ed70c29778d8fec0f4bf6ae28ec.tar.gz
focaccia-qemu-b1b2db29bd6c3ed70c29778d8fec0f4bf6ae28ec.zip
linux-user: Use DIV_ROUND_UP
Replace (((n) + (d) - 1) /(d)) by DIV_ROUND_UP(n,d).

This patch is the result of coccinelle script
scripts/coccinelle/round.cocci

CC: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--linux-user/syscall.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index df70255e5f..96ec801240 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -829,7 +829,7 @@ static inline abi_long copy_from_user_fdset(fd_set *fds,
     int i, nw, j, k;
     abi_ulong b, *target_fds;
 
-    nw = (n + TARGET_ABI_BITS - 1) / TARGET_ABI_BITS;
+    nw = DIV_ROUND_UP(n, TARGET_ABI_BITS);
     if (!(target_fds = lock_user(VERIFY_READ,
                                  target_fds_addr,
                                  sizeof(abi_ulong) * nw,
@@ -876,7 +876,7 @@ static inline abi_long copy_to_user_fdset(abi_ulong target_fds_addr,
     abi_long v;
     abi_ulong *target_fds;
 
-    nw = (n + TARGET_ABI_BITS - 1) / TARGET_ABI_BITS;
+    nw = DIV_ROUND_UP(n, TARGET_ABI_BITS);
     if (!(target_fds = lock_user(VERIFY_WRITE,
                                  target_fds_addr,
                                  sizeof(abi_ulong) * nw,