From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Subject: [PATCH 4/9] bitmap: Use for_each_set_bit
Date: Tue, 2 Feb 2010 00:10:35 +0900 [thread overview]
Message-ID: <1265037040-23413-4-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1265037040-23413-1-git-send-email-akinobu.mita@gmail.com>
v2: rename for_each_bit to for_each_set_bit
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
lib/bitmap.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 11bf497..5f18bb0 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -733,10 +733,9 @@ void bitmap_remap(unsigned long *dst, const unsigned long *src,
bitmap_zero(dst, bits);
w = bitmap_weight(new, bits);
- for (oldbit = find_first_bit(src, bits);
- oldbit < bits;
- oldbit = find_next_bit(src, bits, oldbit + 1)) {
+ for_each_set_bit(oldbit, src, bits) {
int n = bitmap_pos_to_ord(old, oldbit, bits);
+
if (n < 0 || w == 0)
set_bit(oldbit, dst); /* identity map */
else
@@ -903,9 +902,7 @@ void bitmap_onto(unsigned long *dst, const unsigned long *orig,
*/
m = 0;
- for (n = find_first_bit(relmap, bits);
- n < bits;
- n = find_next_bit(relmap, bits, n + 1)) {
+ for_each_set_bit(n, relmap, bits) {
/* m == bitmap_pos_to_ord(relmap, n, bits) */
if (test_bit(m, orig))
set_bit(n, dst);
@@ -934,9 +931,7 @@ void bitmap_fold(unsigned long *dst, const unsigned long *orig,
return;
bitmap_zero(dst, bits);
- for (oldbit = find_first_bit(orig, bits);
- oldbit < bits;
- oldbit = find_next_bit(orig, bits, oldbit + 1))
+ for_each_set_bit(oldbit, orig, bits)
set_bit(oldbit % sz, dst);
}
EXPORT_SYMBOL(bitmap_fold);
--
1.6.0.6
next prev parent reply other threads:[~2010-02-01 15:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-01 15:10 [PATCH 1/9] bitops: rename for_each_bit to for_each_set_bit Akinobu Mita
2010-02-01 15:10 ` [PATCH 2/9] sgi-gru: Use for_each_set_bit Akinobu Mita
2010-02-01 15:10 ` [PATCH 3/9] sched: " Akinobu Mita
2010-02-01 15:10 ` Akinobu Mita [this message]
2010-02-01 15:10 ` [PATCH 5/9] phonet: " Akinobu Mita
2010-02-01 15:10 ` [PATCH 6/9] intel-iommu: " Akinobu Mita
2010-02-01 15:10 ` [PATCH 7/9] infiniband: " Akinobu Mita
2010-02-01 15:10 ` [PATCH 8/9] atm: " Akinobu Mita
2010-02-01 15:10 ` [PATCH 9/9] hpet: " Akinobu Mita
2010-02-01 17:25 ` [PATCH 1/9] bitops: rename for_each_bit to for_each_set_bit Joe Perches
2010-03-05 4:57 ` Stephen Rothwell
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=1265037040-23413-4-git-send-email-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®