1 #ifndef _LINUX_BITOPS_H 2 #define _LINUX_BITOPS_H 5 #include <linux/types.h> 8 #define BIT(nr) (1 << (nr)) 9 #define BIT_MASK(nr) (1 << ((nr) % BITS_PER_LONG)) 10 #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) 11 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG) 12 #define BITS_PER_BYTE 8 28 #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) 44 static inline unsigned long __ffs(
unsigned long word)
48 #if BITS_PER_LONG == 64 49 if ((
word & 0xffffffff) == 0) {
54 if ((
word & 0xffff) == 0) {
58 if ((
word & 0xff) == 0) {
62 if ((
word & 0xf) == 0) {
66 if ((
word & 0x3) == 0) {
91 x += (
sizeof(*addr)<<3);
109 #define ffz(x) __ffs(~(x)) 163 if (!(
x & 0xffff0000u)) {
167 if (!(
x & 0xff000000u)) {
171 if (!(
x & 0xf0000000u)) {
175 if (!(
x & 0xc0000000u)) {
179 if (!(
x & 0x80000000u)) {
194 #define for_each_bit(bit, addr, size) \ 195 for ((bit) = find_first_bit((addr), (size)); \ 197 (bit) = find_next_bit((addr), (size), (bit) + 1)) 253 unsigned int res = (
w & 0x55555555) + ((
w >> 1) & 0x55555555);
254 res = (
res & 0x33333333) + ((
res >> 2) & 0x33333333);
255 res = (
res & 0x0F0F0F0F) + ((
res >> 4) & 0x0F0F0F0F);
256 res = (
res & 0x00FF00FF) + ((
res >> 8) & 0x00FF00FF);
257 return (
res & 0x0000FFFF) + ((
res >> 16) & 0x0000FFFF);
262 #if BITS_PER_LONG < 64 266 res = (
w & 0x5555555555555555
U) + ((
w >> 1) & 0x5555555555555555
U);
267 res = (
res & 0x3333333333333333
U) + ((
res >> 2) & 0x3333333333333333
U);
268 res = (
res & 0x0F0F0F0F0F0F0F0F
U) + ((
res >> 4) & 0x0F0F0F0F0F0F0F0F
U);
269 res = (
res & 0x00FF00FF00FF00FF
U) + ((
res >> 8) & 0x00FF00FF00FF00FF
U);
270 res = (
res & 0x0000FFFF0000FFFF
U) + ((
res >> 16) & 0x0000FFFF0000FFFF
U);
271 return (
res & 0x00000000FFFFFFFFU) + ((
res >> 32) & 0x00000000FFFFFFFFU);
GLuint GLdouble GLdouble GLint GLint order
GLubyte GLubyte GLubyte GLubyte w
static unsigned long __ffs(unsigned long word)
GLdouble GLdouble GLdouble r
GLuint GLuint GLsizei count
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
static int fls64(__u64 x)
GLint GLint GLint GLint GLint x
GLfloat GLfloat GLfloat GLfloat h
static unsigned fls_long(unsigned long l)
static __inline int get_bitmask_order(unsigned int count)
static unsigned long hweight32(unsigned long w)
static __u32 rol32(__u32 word, unsigned int shift)
GLenum const GLvoid * addr
static unsigned find_first_bit(const unsigned long *addr, unsigned size)
static __inline int get_count_order(unsigned int count)
static __u32 ror32(__u32 word, unsigned int shift)
static unsigned long hweight64(__u64 w)
static unsigned long hweight_long(unsigned long w)
int find_next_zero_bit(const unsigned long *addr, int size, int offset)