]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-ia64/bitops.h
serial: fix enable_irq_wake/disable_irq_wake imbalance in serial_core.c
[linux-2.6-omap-h63xx.git] / include / asm-ia64 / bitops.h
index 953d3df9dd22670f16fec92440a9dc18f5431593..e2ca800373351d26b1042394275ebe10f6c8d23e 100644 (file)
@@ -407,6 +407,22 @@ fls (int t)
        return ia64_popcnt(x);
 }
 
+/*
+ * Find the last (most significant) bit set.  Undefined for x==0.
+ * Bits are numbered from 0..63 (e.g., __fls(9) == 3).
+ */
+static inline unsigned long
+__fls (unsigned long x)
+{
+       x |= x >> 1;
+       x |= x >> 2;
+       x |= x >> 4;
+       x |= x >> 8;
+       x |= x >> 16;
+       x |= x >> 32;
+       return ia64_popcnt(x) - 1;
+}
+
 #include <asm-generic/bitops/fls64.h>
 
 /*