[parisc-linux] backport bitops.h stuff
Joel Soete
jsoe0708@tiscali.be
Fri, 1 Aug 2003 17:28:00 +0200
Hi pa,
Can somebody help me to ci inot 2.4 this patch which backport ffs() needed
for new devmapper ;)
--- bitops.h.orig 2003-08-01 15:25:02.000000000 +0200
+++ bitops.h 2003-08-01 15:27:38.000000000 +0200
@@ -208,13 +208,34 @@
#ifdef __KERNEL__
+/**
+ * __ffs - find first bit in word.
+ * @word: The word to search
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ */
+static __inline__ unsigned long __ffs(unsigned long word)
+{
+ unsigned long result = 0;
+
+ while (!(word & 1UL)) {
+ result++;
+ word >>= 1;
+ }
+ return result;
+}
+
/*
* ffs: find first bit set. This is defined the same way as
* the libc and compiler builtin ffs routines, therefore
* differs in spirit from the above ffz (man ffs).
*/
-
-#define ffs(x) generic_ffs(x)
+static __inline__ int ffs(int x)
+{
+ if (!x)
+ return 0;
+ return __ffs((unsigned long)x);
+}
/*
* hweightN: returns the hamming weight (i.e. the number
Thanks in advance,
Joel
------------------------------------------------------
Soldes Tiscali ADSL : 27,50 euros/mois jusque fin 2003.
On s'habitue vite à payer son ADSL moins cher!
Plus d'info? Cliquez ici... http://reg.tiscali.be/default.asp?lg=fr