Path: blob/master/include/asm-generic/bitops/sched.h
10818 views
#ifndef _ASM_GENERIC_BITOPS_SCHED_H_1#define _ASM_GENERIC_BITOPS_SCHED_H_23#include <linux/compiler.h> /* unlikely() */4#include <asm/types.h>56/*7* Every architecture must define this function. It's the fastest8* way of searching a 100-bit bitmap. It's guaranteed that at least9* one of the 100 bits is cleared.10*/11static inline int sched_find_first_bit(const unsigned long *b)12{13#if BITS_PER_LONG == 6414if (b[0])15return __ffs(b[0]);16return __ffs(b[1]) + 64;17#elif BITS_PER_LONG == 3218if (b[0])19return __ffs(b[0]);20if (b[1])21return __ffs(b[1]) + 32;22if (b[2])23return __ffs(b[2]) + 64;24return __ffs(b[3]) + 96;25#else26#error BITS_PER_LONG not defined27#endif28}2930#endif /* _ASM_GENERIC_BITOPS_SCHED_H_ */313233