qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PULL 51/52] qemu-timer: Use DIV_ROUND_UP


From: Michael Tokarev
Subject: [Qemu-trivial] [PULL 51/52] qemu-timer: Use DIV_ROUND_UP
Date: Sun, 5 Jun 2016 10:43:28 +0300

From: Laurent Vivier <address@hidden>

Replace (((n) + (d) - 1) /(d)) by DIV_ROUND_UP(n,d).

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

CC: Paolo Bonzini <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
 qemu-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-timer.c b/qemu-timer.c
index 4441fe6..eb22e92 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -292,7 +292,7 @@ int qemu_timeout_ns_to_ms(int64_t ns)
     /* Always round up, because it's better to wait too long than to wait too
      * little and effectively busy-wait
      */
-    ms = (ns + SCALE_MS - 1) / SCALE_MS;
+    ms = DIV_ROUND_UP(ns, SCALE_MS);
 
     /* To avoid overflow problems, limit this to 2^31, i.e. approx 25 days */
     if (ms > (int64_t) INT32_MAX) {
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]