qemu-trivial
[Top][All Lists]
Advanced

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

[PULL 05/19] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms


From: Laurent Vivier
Subject: [PULL 05/19] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms
Date: Fri, 25 Oct 2019 10:34:57 +0200

From: Frediano Ziglio <address@hidden>

Signed-off-by: Frediano Ziglio <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Message-Id: <address@hidden>
[lv: removed the two useless casts]
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
---
 util/qemu-timer.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/util/qemu-timer.c b/util/qemu-timer.c
index d428fec56772..ef52d28d3753 100644
--- a/util/qemu-timer.c
+++ b/util/qemu-timer.c
@@ -322,11 +322,7 @@ int qemu_timeout_ns_to_ms(int64_t ns)
     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) {
-        ms = INT32_MAX;
-    }
-
-    return (int) ms;
+    return MIN(ms, INT32_MAX);
 }
 
 
-- 
2.21.0




reply via email to

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