Skip to contentSkip to conversation

avr32: define __fls

PATCH New Rusty Russell 1 participant 1 message Dec 3, 2008 Bitops API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 avr32: define __fls

Like fls, but can't be handed 0 and returns the bit number.

(I added find_last_bit() to bitmap.h which broke archs which didn't
define this)

---
 arch/avr32/include/asm/bitops.h |    5 +++++
 1 file changed, 5 insertions(+)
arch/avr32/include/asm/bitops.h +5 -0
@@ -263,6 +263,11 @@ static inline int fls(unsigned long word
 	return 32 - result;
 }
 
+static inline int __fls(unsigned long word)
+{
+	return fls(word) - 1;
+}
+
 unsigned long find_first_zero_bit(const unsigned long *addr,
 				  unsigned long size);
 unsigned long find_next_zero_bit(const unsigned long *addr,