Readd the arch ffz functions
[fio.git] / arch / arch-ppc.h
index 4d7710520dc06574c64f74793551d85842cd4b8b..6256d056c324c7ec8df797251ad61a66fdd87d8f 100644 (file)
        __asm__ __volatile__ ("sync" : : : "memory")
 #endif
 
+static inline int __ilog2(unsigned long bitmask)
+{
+       int lz;
+
+       asm ("cntlzw %0,%1" : "=r" (lz) : "r" (bitmask));
+       return 31 - lz;
+}
+
+static inline int arch_ffz(unsigned long bitmask)
+{
+       if ((bitmask = ~bitmask) == 0)
+               return 32;
+       return  __ilog2(bitmask & -bitmask);
+}
+#define ARCH_HAVE_FFZ
+
 #endif