qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 10/29] vvfat: use DIV_ROUND_UP


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 10/29] vvfat: use DIV_ROUND_UP
Date: Thu, 13 Jul 2017 15:21:28 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/13/2017 11:32 AM, Marc-André Lureau wrote:
> I used the clang-tidy qemu-round check to generate the fix:
> https://github.com/elmarco/clang-tools-extra
> 
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
>  block/vvfat.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Eric Blake <address@hidden>

> 
> diff --git a/block/vvfat.c b/block/vvfat.c
> index 4fd28e1e87..c08c4fb525 100644
> --- a/block/vvfat.c
> +++ b/block/vvfat.c
> @@ -437,7 +437,7 @@ static direntry_t *create_long_filename(BDRVVVFATState 
> *s, const char *filename)
>          return NULL;
>      }
>  
> -    number_of_entries = (length * 2 + 25) / 26;
> +    number_of_entries = DIV_ROUND_UP(length * 2, 26);

Wow - a non-power-of-2!  Good thing our macro works for that.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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