summaryrefslogtreecommitdiff
path: root/qemu-timer.c
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2016-05-31 18:36:04 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2016-06-07 18:19:25 +0300
commit5029b969d1475fad8f294be6edaa66d280df3039 (patch)
tree9a20363471fe97fe20c730f3038de32f1d038a21 /qemu-timer.c
parentb1b2db29bd6c3ed70c29778d8fec0f4bf6ae28ec (diff)
qemu-timer: 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: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'qemu-timer.c')
-rw-r--r--qemu-timer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qemu-timer.c b/qemu-timer.c
index 4441fe66ff..eb22e9218b 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) {