0001
0002 #ifndef _ASM_GENERIC_BITOPS_SCHED_H_
0003 #define _ASM_GENERIC_BITOPS_SCHED_H_
0004
0005 #include <linux/compiler.h> /* unlikely() */
0006 #include <asm/types.h>
0007
0008
0009
0010
0011
0012
0013 static inline int sched_find_first_bit(const unsigned long *b)
0014 {
0015 #if BITS_PER_LONG == 64
0016 if (b[0])
0017 return __ffs(b[0]);
0018 return __ffs(b[1]) + 64;
0019 #elif BITS_PER_LONG == 32
0020 if (b[0])
0021 return __ffs(b[0]);
0022 if (b[1])
0023 return __ffs(b[1]) + 32;
0024 if (b[2])
0025 return __ffs(b[2]) + 64;
0026 return __ffs(b[3]) + 96;
0027 #else
0028 #error BITS_PER_LONG not defined
0029 #endif
0030 }
0031
0032 #endif