summaryrefslogtreecommitdiff
path: root/kern/bitmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'kern/bitmap.h')
-rw-r--r--kern/bitmap.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/kern/bitmap.h b/kern/bitmap.h
index 3663469d..fb22d69f 100644
--- a/kern/bitmap.h
+++ b/kern/bitmap.h
@@ -16,6 +16,9 @@
*
*
* Arbitrary-length bit arrays.
+ *
+ * Most functions do not check whether the given parameters are valid. This
+ * is the responsibility of the caller.
*/
#ifndef _KERN_BITMAP_H
@@ -156,4 +159,10 @@ bitmap_find_first(volatile unsigned long *bm, int nr_bits)
return bitmap_find_next(bm, nr_bits, 0);
}
+#define bitmap_for_each(bm, nr_bits, bit) \
+for ((bit) = 0; \
+ ((bit) < nr_bits) \
+ && (((bit) = bitmap_find_next(bm, nr_bits, bit)) != -1); \
+ (bit)++)
+
#endif /* _KERN_BITMAP_H */