linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / include / asm-x86_64 / bitops.h
index f7ba57b..eb4df23 100644 (file)
@@ -5,7 +5,13 @@
  * Copyright 1992, Linus Torvalds.
  */
 
-#include <asm/alternative.h>
+#include <linux/config.h>
+
+#ifdef CONFIG_SMP
+#define LOCK_PREFIX "lock ; "
+#else
+#define LOCK_PREFIX ""
+#endif
 
 #define ADDR (*(volatile long *) addr)
 
@@ -350,7 +356,14 @@ static __inline__ unsigned long __fls(unsigned long word)
 
 #ifdef __KERNEL__
 
-#include <asm-generic/bitops/sched.h>
+static inline int sched_find_first_bit(const unsigned long *b)
+{
+       if (b[0])
+               return __ffs(b[0]);
+       if (b[1])
+               return __ffs(b[1]) + 64;
+       return __ffs(b[2]) + 128;
+}
 
 /**
  * ffs - find first bit set
@@ -399,20 +412,43 @@ static __inline__ int fls(int x)
        return r+1;
 }
 
-#include <asm-generic/bitops/hweight.h>
+/**
+ * hweightN - returns the hamming weight of a N-bit word
+ * @x: the word to weigh
+ *
+ * The Hamming Weight of a number is the total number of bits set in it.
+ */
+
+#define hweight64(x) generic_hweight64(x)
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
 
 #endif /* __KERNEL__ */
 
 #ifdef __KERNEL__
 
-#include <asm-generic/bitops/ext2-non-atomic.h>
-
+#define ext2_set_bit(nr,addr) \
+       __test_and_set_bit((nr),(unsigned long*)addr)
 #define ext2_set_bit_atomic(lock,nr,addr) \
                test_and_set_bit((nr),(unsigned long*)addr)
+#define ext2_clear_bit(nr, addr) \
+       __test_and_clear_bit((nr),(unsigned long*)addr)
 #define ext2_clear_bit_atomic(lock,nr,addr) \
                test_and_clear_bit((nr),(unsigned long*)addr)
-
-#include <asm-generic/bitops/minix.h>
+#define ext2_test_bit(nr, addr)      test_bit((nr),(unsigned long*)addr)
+#define ext2_find_first_zero_bit(addr, size) \
+       find_first_zero_bit((unsigned long*)addr, size)
+#define ext2_find_next_zero_bit(addr, size, off) \
+       find_next_zero_bit((unsigned long*)addr, size, off)
+
+/* Bitmap functions for the minix filesystem.  */
+#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,(void*)addr)
+#define minix_set_bit(nr,addr) __set_bit(nr,(void*)addr)
+#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,(void*)addr)
+#define minix_test_bit(nr,addr) test_bit(nr,(void*)addr)
+#define minix_find_first_zero_bit(addr,size) \
+       find_first_zero_bit((void*)addr,size)
 
 #endif /* __KERNEL__ */