Whamcloud - gitweb
LU-1756 kernel: cleanup lustre_compat25.h
[fs/lustre-release.git] / libcfs / include / libcfs / user-bitops.h
index 1b36407..3e667f1 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,7 +24,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -84,11 +82,11 @@ static __inline__ unsigned long __cfs_fls(long data)
                return 0;
 
 #if BITS_PER_LONG == 64
-        pos += 32;
-
-        if ((data & 0xFFFFFFFF) == 0) {
-                data <<= 32;
-                pos -= 32;
+        /* 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