patch-2.4.13 linux/include/asm-alpha/bitops.h
Next file: linux/include/asm-alpha/core_cia.h
Previous file: linux/fs/vfat/vfatfs_syms.c
Back to the patch index
Back to the overall index
- Lines: 160
- Date:
Fri Oct 12 15:35:54 2001
- Orig file:
v2.4.12/linux/include/asm-alpha/bitops.h
- Orig date:
Thu May 24 15:20:18 2001
diff -u --recursive --new-file v2.4.12/linux/include/asm-alpha/bitops.h linux/include/asm-alpha/bitops.h
@@ -20,7 +20,7 @@
* bit 0 is the LSB of addr; bit 64 is the LSB of (addr+1).
*/
-extern __inline__ void
+static inline void
set_bit(unsigned long nr, volatile void * addr)
{
unsigned long temp;
@@ -41,7 +41,7 @@
/*
* WARNING: non atomic version.
*/
-extern __inline__ void
+static inline void
__set_bit(unsigned long nr, volatile void * addr)
{
int *m = ((int *) addr) + (nr >> 5);
@@ -52,7 +52,7 @@
#define smp_mb__before_clear_bit() smp_mb()
#define smp_mb__after_clear_bit() smp_mb()
-extern __inline__ void
+static inline void
clear_bit(unsigned long nr, volatile void * addr)
{
unsigned long temp;
@@ -81,7 +81,7 @@
*m ^= 1 << (nr & 31);
}
-extern __inline__ void
+static inline void
change_bit(unsigned long nr, volatile void * addr)
{
unsigned long temp;
@@ -99,7 +99,7 @@
:"Ir" (1UL << (nr & 31)), "m" (*m));
}
-extern __inline__ int
+static inline int
test_and_set_bit(unsigned long nr, volatile void *addr)
{
unsigned long oldbit;
@@ -129,7 +129,7 @@
/*
* WARNING: non atomic version.
*/
-extern __inline__ int
+static inline int
__test_and_set_bit(unsigned long nr, volatile void * addr)
{
unsigned long mask = 1 << (nr & 0x1f);
@@ -140,7 +140,7 @@
return (old & mask) != 0;
}
-extern __inline__ int
+static inline int
test_and_clear_bit(unsigned long nr, volatile void * addr)
{
unsigned long oldbit;
@@ -170,7 +170,7 @@
/*
* WARNING: non atomic version.
*/
-extern __inline__ int
+static inline int
__test_and_clear_bit(unsigned long nr, volatile void * addr)
{
unsigned long mask = 1 << (nr & 0x1f);
@@ -195,7 +195,7 @@
return (old & mask) != 0;
}
-extern __inline__ int
+static inline int
test_and_change_bit(unsigned long nr, volatile void * addr)
{
unsigned long oldbit;
@@ -220,7 +220,7 @@
return oldbit != 0;
}
-extern __inline__ int
+static inline int
test_bit(int nr, volatile void * addr)
{
return (1UL & (((const int *) addr)[nr >> 5] >> (nr & 31))) != 0UL;
@@ -233,7 +233,7 @@
* Do a binary search on the bits. Due to the nature of large
* constants on the alpha, it is worthwhile to split the search.
*/
-extern inline unsigned long ffz_b(unsigned long x)
+static inline unsigned long ffz_b(unsigned long x)
{
unsigned long sum = 0;
@@ -245,7 +245,7 @@
return sum;
}
-extern inline unsigned long ffz(unsigned long word)
+static inline unsigned long ffz(unsigned long word)
{
#if defined(__alpha_cix__) && defined(__alpha_fix__)
/* Whee. EV67 can calculate it directly. */
@@ -272,12 +272,32 @@
* differs in spirit from the above ffz (man ffs).
*/
-extern inline int ffs(int word)
+static inline int ffs(int word)
{
int result = ffz(~word);
return word ? result+1 : 0;
}
+/* Compute powers of two for the given integer. */
+static inline int floor_log2(unsigned long word)
+{
+ long bit;
+#if defined(__alpha_cix__) && defined(__alpha_fix__)
+ __asm__("ctlz %1,%0" : "=r"(bit) : "r"(word));
+ return 63 - bit;
+#else
+ for (bit = -1; word ; bit++)
+ word >>= 1;
+ return bit;
+#endif
+}
+
+static inline int ceil_log2(unsigned int word)
+{
+ long bit = floor_log2(word);
+ return bit + (word > (1UL << bit));
+}
+
/*
* hweightN: returns the hamming weight (i.e. the number
* of bits set) of a N-bit word
@@ -285,7 +305,7 @@
#if defined(__alpha_cix__) && defined(__alpha_fix__)
/* Whee. EV67 can calculate it directly. */
-extern __inline__ unsigned long hweight64(unsigned long w)
+static inline unsigned long hweight64(unsigned long w)
{
unsigned long result;
__asm__("ctpop %1,%0" : "=r"(result) : "r"(w));
@@ -306,7 +326,7 @@
/*
* Find next zero bit in a bitmap reasonably efficiently..
*/
-extern inline unsigned long
+static inline unsigned long
find_next_zero_bit(void * addr, unsigned long size, unsigned long offset)
{
unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)