/* SPDX-License-Identifier: GPL-2.0 */1#ifndef _ASM_GENERIC_BITOPS_SCHED_H_2#define _ASM_GENERIC_BITOPS_SCHED_H_34#include <linux/compiler.h> /* unlikely() */5#include <asm/types.h>67/*8* Every architecture must define this function. It's the fastest9* way of searching a 100-bit bitmap. It's guaranteed that at least10* one of the 100 bits is cleared.11*/12static inline int sched_find_first_bit(const unsigned long *b)13{14#if BITS_PER_LONG == 6415if (b[0])16return __ffs(b[0]);17return __ffs(b[1]) + 64;18#elif BITS_PER_LONG == 3219if (b[0])20return __ffs(b[0]);21if (b[1])22return __ffs(b[1]) + 32;23if (b[2])24return __ffs(b[2]) + 64;25return __ffs(b[3]) + 96;26#else27#error BITS_PER_LONG not defined28#endif29}3031#endif /* _ASM_GENERIC_BITOPS_SCHED_H_ */323334