]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ntfs/ntfs.h
[PATCH] autofs4: atomic var underflow
[linux-2.6-omap-h63xx.git] / fs / ntfs / ntfs.h
index 0624c8ef4d9ca9611ad3a877353c052fabc80ea4..166142960b53be467e9392f0d13ce87057185445 100644 (file)
@@ -132,4 +132,33 @@ extern int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
 /* From fs/ntfs/upcase.c */
 extern ntfschar *generate_default_upcase(void);
 
+static inline int ntfs_ffs(int x)
+{
+       int r = 1;
+
+       if (!x)
+               return 0;
+       if (!(x & 0xffff)) {
+               x >>= 16;
+               r += 16;
+       }
+       if (!(x & 0xff)) {
+               x >>= 8;
+               r += 8;
+       }
+       if (!(x & 0xf)) {
+               x >>= 4;
+               r += 4;
+       }
+       if (!(x & 3)) {
+               x >>= 2;
+               r += 2;
+       }
+       if (!(x & 1)) {
+               x >>= 1;
+               r += 1;
+       }
+       return r;
+}
+
 #endif /* _LINUX_NTFS_H */