[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qemu-timer: remove unnecessary code
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] qemu-timer: remove unnecessary code |
Date: |
Wed, 13 Jul 2016 12:21:15 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 |
On 13/07/2016 11:06, Cao jin wrote:
> When passed argument 'ns' is 0, macro DIV_ROUND_UP will return 0 also.
It's potentially slower though.
Paolo
> Cc: Paolo Bonzini <address@hidden>
> Signed-off-by: Cao jin <address@hidden>
> ---
> qemu-timer.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/qemu-timer.c b/qemu-timer.c
> index eb22e92..cfe0893 100644
> --- a/qemu-timer.c
> +++ b/qemu-timer.c
> @@ -285,12 +285,8 @@ int qemu_timeout_ns_to_ms(int64_t ns)
> return -1;
> }
>
> - if (!ns) {
> - return 0;
> - }
> -
> /* Always round up, because it's better to wait too long than to wait too
> - * little and effectively busy-wait
> + * short and effectively busy-wait
> */
> ms = DIV_ROUND_UP(ns, SCALE_MS);
>
>