Skip to content

Commit 5bd3435

Browse files
Frediano Zigliovivier
Frediano Ziglio
authored andcommitted
qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms
Signed-off-by: Frediano Ziglio <[email protected]> Reviewed-by: Laurent Vivier <[email protected]> Message-Id: <[email protected]> [lv: removed the two useless casts] Reviewed-by: Eric Blake <[email protected]> Signed-off-by: Laurent Vivier <[email protected]>
1 parent 105e102 commit 5bd3435

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

util/qemu-timer.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,7 @@ int qemu_timeout_ns_to_ms(int64_t ns)
322322
ms = DIV_ROUND_UP(ns, SCALE_MS);
323323

324324
/* To avoid overflow problems, limit this to 2^31, i.e. approx 25 days */
325-
if (ms > (int64_t) INT32_MAX) {
326-
ms = INT32_MAX;
327-
}
328-
329-
return (int) ms;
325+
return MIN(ms, INT32_MAX);
330326
}
331327

332328

0 commit comments

Comments
 (0)