qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH 16/16] hbitmap: Use DIV_ROUND_UP


From: John Snow
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 16/16] hbitmap: Use DIV_ROUND_UP
Date: Fri, 3 Jun 2016 14:17:00 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0


On 05/31/2016 12:36 PM, Laurent Vivier wrote:
> 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 <address@hidden>
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
>  tests/test-hbitmap.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c
> index abe1427..097fe8e 100644
> --- a/tests/test-hbitmap.c
> +++ b/tests/test-hbitmap.c
> @@ -80,7 +80,7 @@ static void hbitmap_test_init(TestHBitmapData *data,
>      size_t n;
>      data->hb = hbitmap_alloc(size, granularity);
>  
> -    n = (size + BITS_PER_LONG - 1) / BITS_PER_LONG;
> +    n = DIV_ROUND_UP(size, BITS_PER_LONG);
>      if (n == 0) {
>          n = 1;
>      }
> @@ -94,7 +94,7 @@ static void hbitmap_test_init(TestHBitmapData *data,
>  
>  static inline size_t hbitmap_test_array_size(size_t bits)
>  {
> -    size_t n = (bits + BITS_PER_LONG - 1) / BITS_PER_LONG;
> +    size_t n = DIV_ROUND_UP(bits, BITS_PER_LONG);
>      return n ? n : 1;
>  }
>  
> @@ -186,7 +186,7 @@ static void hbitmap_test_reset_all(TestHBitmapData *data)
>  
>      hbitmap_reset_all(data->hb);
>  
> -    n = (data->size + BITS_PER_LONG - 1) / BITS_PER_LONG;
> +    n = DIV_ROUND_UP(data->size, BITS_PER_LONG);
>      if (n == 0) {
>          n = 1;
>      }
> 

Reviewed-by: John Snow <address@hidden>



reply via email to

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