+static __inline__ unsigned long fls(long data)
+{
+ int pos = 32;
+
+ if (!data)
+ return 0;
+
+#if BITS_PER_LONG == 64
+ /* If any bit of the high 32 bits are set, shift the high
+ * 32 bits down and pretend like it is a 32-bit value. */
+ if ((data & 0xFFFFFFFF00000000llu)) {
+ data >>= 32;
+ pos += 32;
+ }
+#endif
+
+ if (!(data & 0xFFFF0000u)) {
+ data <<= 16;
+ pos -= 16;
+ }
+ if (!(data & 0xFF000000u)) {
+ data <<= 8;
+ pos -= 8;
+ }
+ if (!(data & 0xF0000000u)) {
+ data <<= 4;
+ pos -= 4;
+ }
+ if (!(data & 0xC0000000u)) {
+ data <<= 2;
+ pos -= 2;
+ }
+ if (!(data & 0x80000000u)) {
+ data <<= 1;
+ pos -= 1;
+ }
+ return pos;
+}
+
+static __inline__ unsigned long __cfs_ffs(long data)