Messages in this thread Patch in this message | | | From | Akinobu Mita <> | Subject | [PATCH 1/8] iommu-helper: Simplify find_next_zero_area | Date | Fri, 9 Oct 2009 17:29:14 +0900 |
| |
Use find_next_bit instead of doing test_bit for each bit
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> --- lib/iommu-helper.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c index 75dbda0..dddbf22 100644 --- a/lib/iommu-helper.c +++ b/lib/iommu-helper.c @@ -21,11 +21,10 @@ again: end = index + nr; if (end >= size) return -1; - for (i = index; i < end; i++) { - if (test_bit(i, map)) { - start = i+1; - goto again; - } + i = find_next_bit(map, end, index); + if (i < end) { + start = i + 1; + goto again; } return index; } -- 1.5.4.3
| |