Fix shifting bug in radix_insert()
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 19 Aug 2016 19:57:18 +0000 (15:57 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 19 Aug 2016 19:57:18 +0000 (15:57 -0400)
This failed to index for keys greater than 32 bits.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/radix.c

index ee15ad2..6fe6d1d 100644 (file)
@@ -72,7 +72,7 @@ int radix_insert(struct radix_tree *tree, unsigned long key, void *item,
                tree->root = r_node;
                r_node->my_slot = &tree->root;
                tree->depth++;
-               tree->upper_bound = 1 << (LOG_RNODE_SLOTS * tree->depth);
+               tree->upper_bound = 1ULL << (LOG_RNODE_SLOTS * tree->depth);
        }
        assert(tree->root);
        /* the tree now thinks it is tall enough, so find the last node, insert in