aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2016-05-31 18:36:05 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2016-06-07 18:19:25 +0300
commit30f549c2f30de65c7cbb30614b838d5478d6221b (patch)
tree17e9b84cbe1d7a404b6d3c001e4648858529f153
parent5029b969d1475fad8f294be6edaa66d280df3039 (diff)
hbitmap: Use DIV_ROUND_UP
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> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--tests/test-hbitmap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c
index 71d0098825..c0e9895fb9 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;
}