aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-i386/bitops.h55
1 files changed, 8 insertions, 47 deletions
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index 7d20b95edb3b..08deaeee6be9 100644
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -362,28 +362,9 @@ static inline unsigned long ffz(unsigned long word)
362 return word; 362 return word;
363} 363}
364 364
365#define fls64(x) generic_fls64(x)
366
367#ifdef __KERNEL__ 365#ifdef __KERNEL__
368 366
369/* 367#include <asm-generic/bitops/sched.h>
370 * Every architecture must define this function. It's the fastest
371 * way of searching a 140-bit bitmap where the first 100 bits are
372 * unlikely to be set. It's guaranteed that at least one of the 140
373 * bits is cleared.
374 */
375static inline int sched_find_first_bit(const unsigned long *b)
376{
377 if (unlikely(b[0]))
378 return __ffs(b[0]);
379 if (unlikely(b[1]))
380 return __ffs(b[1]) + 32;
381 if (unlikely(b[2]))
382 return __ffs(b[2]) + 64;
383 if (b[3])
384 return __ffs(b[3]) + 96;
385 return __ffs(b[4]) + 128;
386}
387 368
388/** 369/**
389 * ffs - find first bit set 370 * ffs - find first bit set
@@ -421,42 +402,22 @@ static inline int fls(int x)
421 return r+1; 402 return r+1;
422} 403}
423 404
424/** 405#include <asm-generic/bitops/hweight.h>
425 * hweightN - returns the hamming weight of a N-bit word
426 * @x: the word to weigh
427 *
428 * The Hamming Weight of a number is the total number of bits set in it.
429 */
430
431#define hweight32(x) generic_hweight32(x)
432#define hweight16(x) generic_hweight16(x)
433#define hweight8(x) generic_hweight8(x)
434 406
435#endif /* __KERNEL__ */ 407#endif /* __KERNEL__ */
436 408
409#include <asm-generic/bitops/fls64.h>
410
437#ifdef __KERNEL__ 411#ifdef __KERNEL__
438 412
439#define ext2_set_bit(nr,addr) \ 413#include <asm-generic/bitops/ext2-non-atomic.h>
440 __test_and_set_bit((nr),(unsigned long*)addr) 414
441#define ext2_set_bit_atomic(lock,nr,addr) \ 415#define ext2_set_bit_atomic(lock,nr,addr) \
442 test_and_set_bit((nr),(unsigned long*)addr) 416 test_and_set_bit((nr),(unsigned long*)addr)
443#define ext2_clear_bit(nr, addr) \
444 __test_and_clear_bit((nr),(unsigned long*)addr)
445#define ext2_clear_bit_atomic(lock,nr, addr) \ 417#define ext2_clear_bit_atomic(lock,nr, addr) \
446 test_and_clear_bit((nr),(unsigned long*)addr) 418 test_and_clear_bit((nr),(unsigned long*)addr)
447#define ext2_test_bit(nr, addr) test_bit((nr),(unsigned long*)addr) 419
448#define ext2_find_first_zero_bit(addr, size) \ 420#include <asm-generic/bitops/minix.h>
449 find_first_zero_bit((unsigned long*)addr, size)
450#define ext2_find_next_zero_bit(addr, size, off) \
451 find_next_zero_bit((unsigned long*)addr, size, off)
452
453/* Bitmap functions for the minix filesystem. */
454#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,(void*)addr)
455#define minix_set_bit(nr,addr) __set_bit(nr,(void*)addr)
456#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,(void*)addr)
457#define minix_test_bit(nr,addr) test_bit(nr,(void*)addr)
458#define minix_find_first_zero_bit(addr,size) \
459 find_first_zero_bit((void*)addr,size)
460 421
461#endif /* __KERNEL__ */ 422#endif /* __KERNEL__ */
462 423