提交 4188e390 编写于 作者: C Chih-Min Chao 提交者: Michael Tokarev

bitops : fix coding style

    don't mix tab and space. The rule is 4 spaces
Signed-off-by: NChih-Min Chao <cmchao@gmail.com>
Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
上级 4d1ba9c4
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
#define BITS_PER_BYTE CHAR_BIT #define BITS_PER_BYTE CHAR_BIT
#define BITS_PER_LONG (sizeof (unsigned long) * BITS_PER_BYTE) #define BITS_PER_LONG (sizeof (unsigned long) * BITS_PER_BYTE)
#define BIT(nr) (1UL << (nr)) #define BIT(nr) (1UL << (nr))
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
#define BIT_WORD(nr) ((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 BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
/** /**
* set_bit - Set a bit in memory * set_bit - Set a bit in memory
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
*/ */
static inline void set_bit(long nr, unsigned long *addr) static inline void set_bit(long nr, unsigned long *addr)
{ {
unsigned long mask = BIT_MASK(nr); unsigned long mask = BIT_MASK(nr);
unsigned long *p = addr + BIT_WORD(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) ...@@ -45,10 +45,10 @@ static inline void set_bit(long nr, unsigned long *addr)
*/ */
static inline void clear_bit(long nr, unsigned long *addr) static inline void clear_bit(long nr, unsigned long *addr)
{ {
unsigned long mask = BIT_MASK(nr); unsigned long mask = BIT_MASK(nr);
unsigned long *p = addr + BIT_WORD(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) ...@@ -58,10 +58,10 @@ static inline void clear_bit(long nr, unsigned long *addr)
*/ */
static inline void change_bit(long nr, unsigned long *addr) static inline void change_bit(long nr, unsigned long *addr)
{ {
unsigned long mask = BIT_MASK(nr); unsigned long mask = BIT_MASK(nr);
unsigned long *p = addr + BIT_WORD(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) ...@@ -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) static inline int test_and_set_bit(long nr, unsigned long *addr)
{ {
unsigned long mask = BIT_MASK(nr); unsigned long mask = BIT_MASK(nr);
unsigned long *p = addr + BIT_WORD(nr); unsigned long *p = addr + BIT_WORD(nr);
unsigned long old = *p; unsigned long old = *p;
*p = old | mask; *p = old | mask;
return (old & mask) != 0; return (old & mask) != 0;
} }
/** /**
...@@ -86,12 +86,12 @@ static inline int test_and_set_bit(long nr, unsigned long *addr) ...@@ -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) static inline int test_and_clear_bit(long nr, unsigned long *addr)
{ {
unsigned long mask = BIT_MASK(nr); unsigned long mask = BIT_MASK(nr);
unsigned long *p = addr + BIT_WORD(nr); unsigned long *p = addr + BIT_WORD(nr);
unsigned long old = *p; unsigned long old = *p;
*p = old & ~mask; *p = old & ~mask;
return (old & mask) != 0; return (old & mask) != 0;
} }
/** /**
...@@ -101,12 +101,12 @@ static inline int test_and_clear_bit(long nr, unsigned long *addr) ...@@ -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) static inline int test_and_change_bit(long nr, unsigned long *addr)
{ {
unsigned long mask = BIT_MASK(nr); unsigned long mask = BIT_MASK(nr);
unsigned long *p = addr + BIT_WORD(nr); unsigned long *p = addr + BIT_WORD(nr);
unsigned long old = *p; unsigned long old = *p;
*p = old ^ mask; *p = old ^ mask;
return (old & mask) != 0; return (old & mask) != 0;
} }
/** /**
...@@ -116,7 +116,7 @@ static inline int test_and_change_bit(long nr, unsigned long *addr) ...@@ -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) 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, ...@@ -136,7 +136,8 @@ unsigned long find_last_bit(const unsigned long *addr,
* @size: The bitmap size in bits * @size: The bitmap size in bits
*/ */
unsigned long find_next_bit(const unsigned long *addr, 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 * find_next_zero_bit - find the next cleared bit in a memory region
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册