]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - lib/radix-tree.c
i386: Remove strrchr assembler implementation
[linux-2.6-omap-h63xx.git] / lib / radix-tree.c
index 53fd44d78716cfb3d0b9f77c1372737e49a1a12b..48c250fe2233d82c6d8fd563e83c234cdf1109ee 100644 (file)
@@ -1049,12 +1049,14 @@ radix_tree_node_ctor(struct kmem_cache *cachep, void *node)
 
 static __init unsigned long __maxindex(unsigned int height)
 {
-       unsigned int tmp = height * RADIX_TREE_MAP_SHIFT;
-       unsigned long index = (~0UL >> (RADIX_TREE_INDEX_BITS - tmp - 1)) >> 1;
-
-       if (tmp >= RADIX_TREE_INDEX_BITS)
-               index = ~0UL;
-       return index;
+       unsigned int width = height * RADIX_TREE_MAP_SHIFT;
+       int shift = RADIX_TREE_INDEX_BITS - width;
+
+       if (shift < 0)
+               return ~0UL;
+       if (shift >= BITS_PER_LONG)
+               return 0UL;
+       return ~0UL >> shift;
 }
 
 static __init void radix_tree_init_maxindex(void)