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