]> err.no Git - linux-2.6/blobdiff - include/linux/bitops.h
[PATCH] nfsd: check error status from nfsd_sync_dir
[linux-2.6] / include / linux / bitops.h
index cb3c3ef50f504408c242028ef3b2e9f1feb7347a..6a2a19f14bb26bb3f4f49815b566c2a4e8353cab 100644 (file)
@@ -76,6 +76,15 @@ static __inline__ int generic_fls(int x)
  */
 #include <asm/bitops.h>
 
+
+static inline int generic_fls64(__u64 x)
+{
+       __u32 h = x >> 32;
+       if (h)
+               return fls(x) + 32;
+       return fls(x);
+}
+
 static __inline__ int get_bitmask_order(unsigned int count)
 {
        int order;
@@ -84,6 +93,16 @@ static __inline__ int get_bitmask_order(unsigned int count)
        return order;   /* We could be slightly more clever with -1 here... */
 }
 
+static __inline__ int get_count_order(unsigned int count)
+{
+       int order;
+       
+       order = fls(count) - 1;
+       if (count & (count - 1))
+               order++;
+       return order;
+}
+
 /*
  * hweightN: returns the hamming weight (i.e. the number
  * of bits set) of a N-bit word