Blame view
include/asm-generic/bitops/sched.h
721 Bytes
6d29ea23d [PATCH] bitops: g... |
1 2 3 4 5 6 7 8 |
#ifndef _ASM_GENERIC_BITOPS_SCHED_H_ #define _ASM_GENERIC_BITOPS_SCHED_H_ #include <linux/compiler.h> /* unlikely() */ #include <asm/types.h> /* * Every architecture must define this function. It's the fastest |
ff80a77f2 sched: simplify s... |
9 10 |
* way of searching a 100-bit bitmap. It's guaranteed that at least * one of the 100 bits is cleared. |
6d29ea23d [PATCH] bitops: g... |
11 12 13 14 |
*/ static inline int sched_find_first_bit(const unsigned long *b) { #if BITS_PER_LONG == 64 |
ff80a77f2 sched: simplify s... |
15 |
if (b[0]) |
6d29ea23d [PATCH] bitops: g... |
16 |
return __ffs(b[0]); |
ff80a77f2 sched: simplify s... |
17 |
return __ffs(b[1]) + 64; |
6d29ea23d [PATCH] bitops: g... |
18 |
#elif BITS_PER_LONG == 32 |
ff80a77f2 sched: simplify s... |
19 |
if (b[0]) |
6d29ea23d [PATCH] bitops: g... |
20 |
return __ffs(b[0]); |
ff80a77f2 sched: simplify s... |
21 |
if (b[1]) |
6d29ea23d [PATCH] bitops: g... |
22 |
return __ffs(b[1]) + 32; |
ff80a77f2 sched: simplify s... |
23 |
if (b[2]) |
6d29ea23d [PATCH] bitops: g... |
24 |
return __ffs(b[2]) + 64; |
ff80a77f2 sched: simplify s... |
25 |
return __ffs(b[3]) + 96; |
6d29ea23d [PATCH] bitops: g... |
26 27 28 29 30 31 |
#else #error BITS_PER_LONG not defined #endif } #endif /* _ASM_GENERIC_BITOPS_SCHED_H_ */ |