1 #ifndef _ASM_GENERIC_BITOPS_LE_H_
2 #define _ASM_GENERIC_BITOPS_LE_H_
5 #include <asm/byteorder.h>
7 #if defined(__LITTLE_ENDIAN)
9 #define BITOP_LE_SWIZZLE 0
11 static inline unsigned long find_next_zero_bit_le(const void *addr
,
12 unsigned long size
, unsigned long offset
)
14 return find_next_zero_bit(addr
, size
, offset
);
17 static inline unsigned long find_next_bit_le(const void *addr
,
18 unsigned long size
, unsigned long offset
)
20 return find_next_bit(addr
, size
, offset
);
23 static inline unsigned long find_first_zero_bit_le(const void *addr
,
26 return find_first_zero_bit(addr
, size
);
29 #elif defined(__BIG_ENDIAN)
31 #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
33 extern unsigned long find_next_zero_bit_le(const void *addr
,
34 unsigned long size
, unsigned long offset
);
35 extern unsigned long find_next_bit_le(const void *addr
,
36 unsigned long size
, unsigned long offset
);
38 #define find_first_zero_bit_le(addr, size) \
39 find_next_zero_bit_le((addr), (size), 0)
42 #error "Please fix <asm/byteorder.h>"
45 static inline int test_bit_le(int nr
, const void *addr
)
47 return test_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
50 static inline void __set_bit_le(int nr
, void *addr
)
52 __set_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
55 static inline void __clear_bit_le(int nr
, void *addr
)
57 __clear_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
60 static inline int test_and_set_bit_le(int nr
, void *addr
)
62 return test_and_set_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
65 static inline int test_and_clear_bit_le(int nr
, void *addr
)
67 return test_and_clear_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
70 static inline int __test_and_set_bit_le(int nr
, void *addr
)
72 return __test_and_set_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
75 static inline int __test_and_clear_bit_le(int nr
, void *addr
)
77 return __test_and_clear_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
80 #endif /* _ASM_GENERIC_BITOPS_LE_H_ */