[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PULL 52/52] hbitmap: Use DIV_ROUND_UP
From: |
Michael Tokarev |
Subject: |
[Qemu-trivial] [PULL 52/52] hbitmap: Use DIV_ROUND_UP |
Date: |
Sun, 5 Jun 2016 10:43:29 +0300 |
From: Laurent Vivier <address@hidden>
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>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Michael Tokarev <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 71d0098..c0e9895 100644
--- a/tests/test-hbitmap.c
+++ b/tests/test-hbitmap.c
@@ -79,7 +79,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;
}
@@ -93,7 +93,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;
}
@@ -185,7 +185,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;
}
--
2.1.4
- [Qemu-trivial] [PULL 24/52] docs: Fix a couple of typos in throttle.txt, (continued)
- [Qemu-trivial] [PULL 36/52] thunk: Rename args and fields in host-target bitmask conversion code, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 42/52] crypto: Use DIV_ROUND_UP, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 50/52] pc-bios/s390-ccw: Use DIV_ROUND_UP, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 29/52] tests: Remove unnecessary glib.h includes, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 52/52] hbitmap: Use DIV_ROUND_UP,
Michael Tokarev <=
- [Qemu-trivial] [PULL 13/52] ppc: Remove a potential overflow in muldiv64(), Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 43/52] xen: Use DIV_ROUND_UP, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 30/52] qga: Remove unnecessary glib.h includes, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 23/52] hw: Clean up includes, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 04/52] qga: spelling fix, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 35/52] thunk: Drop unused NO_THUNK_TYPE_SIZE guards, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 51/52] qemu-timer: Use DIV_ROUND_UP, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 12/52] replace muldiv64(a, b, c) by (uint64_t)a * b / c, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 21/52] fw_cfg: follow CODING_STYLE, Michael Tokarev, 2016/06/05
- [Qemu-trivial] [PULL 02/52] hw/ipmi: fix spelling, Michael Tokarev, 2016/06/05