aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Min Chao <cmchao@gmail.com>2015-04-09 02:04:10 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2015-04-30 16:05:48 +0300
commit4188e39055bfaf6d76b7d98294b0aeb8e4f3082d (patch)
tree24946a21fd9e009262164f2ca419a2328a75c19b
parent4d1ba9c4f8a4d68b9d053946d551ffa8f1006b77 (diff)
downloadqemu-4188e39055bfaf6d76b7d98294b0aeb8e4f3082d.zip
qemu-4188e39055bfaf6d76b7d98294b0aeb8e4f3082d.tar.gz
qemu-4188e39055bfaf6d76b7d98294b0aeb8e4f3082d.tar.bz2
bitops : fix coding style
don't mix tab and space. The rule is 4 spaces Signed-off-by: Chih-Min Chao <cmchao@gmail.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--include/qemu/bitops.h61
1 files changed, 31 insertions, 30 deletions
diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h
index 90ca8df..8abdcf9 100644
--- a/include/qemu/bitops.h
+++ b/include/qemu/bitops.h
@@ -20,10 +20,10 @@
#define BITS_PER_BYTE CHAR_BIT
#define BITS_PER_LONG (sizeof (unsigned long) * BITS_PER_BYTE)
-#define BIT(nr) (1UL << (nr))
-#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
-#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
-#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
+#define BIT(nr) (1UL << (nr))
+#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
+#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
+#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
/**
* set_bit - Set a bit in memory
@@ -32,10 +32,10 @@
*/
static inline void set_bit(long nr, unsigned long *addr)
{
- unsigned long mask = BIT_MASK(nr);
- unsigned long *p = addr + BIT_WORD(nr);
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = addr + BIT_WORD(nr);
- *p |= mask;
+ *p |= mask;
}
/**
@@ -45,10 +45,10 @@ static inline void set_bit(long nr, unsigned long *addr)
*/
static inline void clear_bit(long nr, unsigned long *addr)
{
- unsigned long mask = BIT_MASK(nr);
- unsigned long *p = addr + BIT_WORD(nr);
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = addr + BIT_WORD(nr);
- *p &= ~mask;
+ *p &= ~mask;
}
/**
@@ -58,10 +58,10 @@ static inline void clear_bit(long nr, unsigned long *addr)
*/
static inline void change_bit(long nr, unsigned long *addr)
{
- unsigned long mask = BIT_MASK(nr);
- unsigned long *p = addr + BIT_WORD(nr);
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = addr + BIT_WORD(nr);
- *p ^= mask;
+ *p ^= mask;
}
/**
@@ -71,12 +71,12 @@ static inline void change_bit(long nr, unsigned long *addr)
*/
static inline int test_and_set_bit(long nr, unsigned long *addr)
{
- unsigned long mask = BIT_MASK(nr);
- unsigned long *p = addr + BIT_WORD(nr);
- unsigned long old = *p;
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = addr + BIT_WORD(nr);
+ unsigned long old = *p;
- *p = old | mask;
- return (old & mask) != 0;
+ *p = old | mask;
+ return (old & mask) != 0;
}
/**
@@ -86,12 +86,12 @@ static inline int test_and_set_bit(long nr, unsigned long *addr)
*/
static inline int test_and_clear_bit(long nr, unsigned long *addr)
{
- unsigned long mask = BIT_MASK(nr);
- unsigned long *p = addr + BIT_WORD(nr);
- unsigned long old = *p;
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = addr + BIT_WORD(nr);
+ unsigned long old = *p;
- *p = old & ~mask;
- return (old & mask) != 0;
+ *p = old & ~mask;
+ return (old & mask) != 0;
}
/**
@@ -101,12 +101,12 @@ static inline int test_and_clear_bit(long nr, unsigned long *addr)
*/
static inline int test_and_change_bit(long nr, unsigned long *addr)
{
- unsigned long mask = BIT_MASK(nr);
- unsigned long *p = addr + BIT_WORD(nr);
- unsigned long old = *p;
+ unsigned long mask = BIT_MASK(nr);
+ unsigned long *p = addr + BIT_WORD(nr);
+ unsigned long old = *p;
- *p = old ^ mask;
- return (old & mask) != 0;
+ *p = old ^ mask;
+ return (old & mask) != 0;
}
/**
@@ -116,7 +116,7 @@ static inline int test_and_change_bit(long nr, unsigned long *addr)
*/
static inline int test_bit(long nr, const unsigned long *addr)
{
- return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
+ return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
}
/**
@@ -136,7 +136,8 @@ unsigned long find_last_bit(const unsigned long *addr,
* @size: The bitmap size in bits
*/
unsigned long find_next_bit(const unsigned long *addr,
- unsigned long size, unsigned long offset);
+ unsigned long size,
+ unsigned long offset);
/**
* find_next_zero_bit - find the next cleared bit in a memory region