From: John Snow <jsnow@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>,
qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 16/16] hbitmap: Use DIV_ROUND_UP
Date: Fri, 3 Jun 2016 14:17:00 -0400 [thread overview]
Message-ID: <0fc04ab4-7f1a-28fc-42b0-2aa90dd6cd09@redhat.com> (raw)
In-Reply-To: <1464712565-14857-17-git-send-email-lvivier@redhat.com>
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 <pbonzini@redhat.com>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> 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 <jsnow@redhat.com>
next prev parent reply other threads:[~2016-06-03 18:17 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 16:35 [Qemu-devel] [PATCH 00/16] use macro DIV_ROUND_UP instead of (((n) + (d) - 1) /(d)) Laurent Vivier
2016-05-31 16:35 ` [Qemu-devel] [PATCH 01/16] coccinelle: " Laurent Vivier
2016-05-31 17:12 ` Eric Blake
2016-05-31 17:24 ` Laurent Vivier
2016-05-31 16:35 ` [Qemu-devel] [PATCH 02/16] parallels: Use DIV_ROUND_UP Laurent Vivier
2016-05-31 17:18 ` Eric Blake
2016-05-31 16:35 ` [Qemu-devel] [PATCH 03/16] qcow/qcow2: " Laurent Vivier
2016-05-31 17:20 ` Eric Blake
2016-05-31 16:35 ` [Qemu-devel] [PATCH 04/16] qed: " Laurent Vivier
2016-05-31 17:49 ` Eric Blake
2016-05-31 16:35 ` [Qemu-devel] [PATCH 05/16] block: " Laurent Vivier
2016-05-31 17:50 ` Eric Blake
2016-05-31 16:35 ` [Qemu-devel] [PATCH 06/16] crypto: " Laurent Vivier
2016-05-31 16:45 ` Daniel P. Berrange
2016-05-31 16:35 ` [Qemu-devel] [PATCH 07/16] xen: " Laurent Vivier
2016-06-01 9:33 ` Stefano Stabellini
2016-05-31 16:35 ` [Qemu-devel] [PATCH 08/16] audio: " Laurent Vivier
2016-05-31 16:35 ` [Qemu-devel] [PATCH 09/16] SPICE: " Laurent Vivier
2016-05-31 16:35 ` [Qemu-devel] [PATCH 10/16] rocker: " Laurent Vivier
2016-05-31 16:36 ` [Qemu-devel] [PATCH 11/16] usb: " Laurent Vivier
2016-05-31 16:36 ` [Qemu-devel] [PATCH 12/16] slirp: " Laurent Vivier
2016-05-31 16:41 ` Samuel Thibault
2016-05-31 16:36 ` [Qemu-devel] [PATCH 13/16] linux-user: " Laurent Vivier
2016-05-31 16:36 ` [Qemu-devel] [PATCH 14/16] pc-bios/s390-ccw: " Laurent Vivier
2016-05-31 16:36 ` [Qemu-devel] [PATCH 15/16] qemu-timer: " Laurent Vivier
2016-05-31 16:36 ` [Qemu-devel] [PATCH 16/16] hbitmap: " Laurent Vivier
2016-06-03 18:17 ` John Snow [this message]
2016-06-05 7:16 ` [Qemu-devel] [PATCH 00/16] use macro DIV_ROUND_UP instead of (((n) + (d) - 1) /(d)) Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0fc04ab4-7f1a-28fc-42b0-2aa90dd6cd09@redhat.com \
--to=jsnow@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).