1 #ifndef _X86_64_BITOPS_H
2 #define _X86_64_BITOPS_H
5 * Copyright 1992, Linus Torvalds.
8 extern long find_first_zero_bit(const unsigned long *addr
, unsigned long size
);
9 extern long find_first_bit(const unsigned long *addr
, unsigned long size
);
11 /* return index of first bet set in val or max when no bit is set */
12 static inline long __scanbit(unsigned long val
, unsigned long max
)
14 asm("bsfq %1,%0 ; cmovz %2,%0" : "=&r" (val
) : "r" (val
), "r" (max
));
18 #define find_first_bit(addr, size) \
19 ((__builtin_constant_p((size)) && (size) <= BITS_PER_LONG \
20 ? (__scanbit(*(unsigned long *)(addr), (size))) \
21 : find_first_bit((addr), (size))))
23 #define find_first_zero_bit(addr, size) \
24 ((__builtin_constant_p((size)) && (size) <= BITS_PER_LONG \
25 ? (__scanbit(~*(unsigned long *)(addr), (size))) \
26 : find_first_zero_bit((addr), (size))))
28 static inline void set_bit_string(unsigned long *bitmap
, unsigned long i
,
31 unsigned long end
= i
+ len
;
40 #include <asm-generic/bitops/sched.h>
43 * fls64 - find last bit set in 64 bit word
44 * @x: the word to search
46 * This is defined the same way as fls.
48 static inline int fls64(__u64 x
)
55 #define ARCH_HAS_FAST_MULTIPLIER 1
57 #include <asm-generic/bitops/hweight.h>
59 #endif /* __KERNEL__ */
63 #include <asm-generic/bitops/ext2-non-atomic.h>
65 #define ext2_set_bit_atomic(lock, nr, addr) \
66 test_and_set_bit((nr), (unsigned long *)(addr))
67 #define ext2_clear_bit_atomic(lock, nr, addr) \
68 test_and_clear_bit((nr), (unsigned long *)(addr))
70 #include <asm-generic/bitops/minix.h>
72 #endif /* __KERNEL__ */
74 #endif /* _X86_64_BITOPS_H */
This page took 0.04864 seconds and 5 git commands to generate.