]> git.proxmox.com Git - mirror_qemu.git/commitdiff
linux-user: Use DIV_ROUND_UP
authorLaurent Vivier <lvivier@redhat.com>
Tue, 31 May 2016 16:36:02 +0000 (18:36 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 7 Jun 2016 15:19:25 +0000 (18:19 +0300)
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>
linux-user/syscall.c

index df70255e5f2483a3a005849f8667ed08c3afb72b..96ec80124044b9b2f9527c4933c8e7bf29bbac2b 100644 (file)
@@ -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,