This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / fs / xfs / xfs_bit.c
index a20a6c3..ec12a13 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -154,17 +154,14 @@ int
 xfs_lowbit64(
        __uint64_t      v)
 {
-       __uint32_t      w = (__uint32_t)v;
-       int             n = 0;
-
-       if (w) {        /* lower bits */
-               n = ffs(w);
-       } else {        /* upper bits */
-               w = (__uint32_t)(v >> 32);
-               if (w && (n = ffs(w)))
-                       n += 32;
+       int n;
+       n = ffs((unsigned)v);
+       if (n <= 0) {
+               n = ffs(v >> 32);
+               if (n >= 0)
+                       n+=32;
        }
-       return n - 1;
+       return (n <= 0) ? n : n-1;
 }
 
 /*
@@ -174,11 +171,10 @@ int
 xfs_highbit64(
        __uint64_t      v)
 {
-       __uint32_t      h = (__uint32_t)(v >> 32);
-
+       __uint32_t h = v >> 32;
        if (h)
                return xfs_highbit32(h) + 32;
-       return xfs_highbit32((__uint32_t)v);
+       return xfs_highbit32((__u32)v);
 }