All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] backport bitops.h stuff
@ 2003-08-01 15:28 Joel Soete
  2003-08-01 15:35 ` Joel Soete
  2003-08-01 15:59 ` James Bottomley
  0 siblings, 2 replies; 12+ messages in thread
From: Joel Soete @ 2003-08-01 15:28 UTC (permalink / raw)
  To: parisc-linux

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 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-08-04 17:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-01 15:28 [parisc-linux] backport bitops.h stuff Joel Soete
2003-08-01 15:35 ` Joel Soete
2003-08-01 15:59 ` James Bottomley
2003-08-01 17:09   ` Joel Soete
2003-08-01 17:14     ` LaMont Jones
2003-08-01 17:25       ` Joel Soete
2003-08-01 17:33       ` James Bottomley
2003-08-04 10:43       ` Joel Soete
2003-08-04 15:14         ` LaMont Jones
2003-08-04 16:08           ` James Bottomley
2003-08-04 17:04             ` Joel Soete
2003-08-04 16:53           ` Joel Soete

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.