aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/bitops.h
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2013-05-07 15:12:40 +0100
committerIan Campbell <ian.campbell@citrix.com>2013-05-08 11:02:09 +0100
commitd1688bd8f94402f61a8d74cac908f05b5f5fbc88 (patch)
treee9f90cd2330d05c4ab4fb09f2e6a98395dbc24d3 /xen/include/xen/bitops.h
parent6b0e8e43348a6b5548224ae8edc4907a60bf14d1 (diff)
downloadxen-d1688bd8f94402f61a8d74cac908f05b5f5fbc88.tar.gz
xen-d1688bd8f94402f61a8d74cac908f05b5f5fbc88.tar.bz2
xen-d1688bd8f94402f61a8d74cac908f05b5f5fbc88.zip
xen: move for_each_set_bit to xen/bitops.h
Move for_each_set_bit from asm-x86/bitops.h to xen/bitops.h. Replace #include <asm/bitops.h> with #include <xen/bitops.h> everywhere. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/include/xen/bitops.h')
-rw-r--r--xen/include/xen/bitops.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index c6a78b6512..6054155c82 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -182,4 +182,15 @@ static inline __u32 ror32(__u32 word, unsigned int shift)
#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
#define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
+/**
+ * for_each_set_bit - iterate over every set bit in a memory region
+ * @bit: The integer iterator
+ * @addr: The address to base the search on
+ * @size: The maximum size to search
+ */
+#define for_each_set_bit(bit, addr, size) \
+ for ( (bit) = find_first_bit(addr, size); \
+ (bit) < (size); \
+ (bit) = find_next_bit(addr, size, (bit) + 1) )
+
#endif