Fix unsigned comparison underflow.

These bugs only affected tests and debug builds.
This commit is contained in:
Jason Evans 2015-03-11 23:14:50 -07:00
parent bc45d41d23
commit fbd8d773ad
2 changed files with 2 additions and 2 deletions

View File

@ -260,7 +260,7 @@ rtree_set(rtree_t *rtree, uintptr_t key, const extent_node_t *val)
rtree_val_write(rtree, &node[subkey], val); rtree_val_write(rtree, &node[subkey], val);
return (false); return (false);
} }
assert(i < rtree->height - 1); assert(i + 1 < rtree->height);
child = rtree_child_read(rtree, &node[subkey], i); child = rtree_child_read(rtree, &node[subkey], i);
if (child == NULL) if (child == NULL)
return (true); return (true);

View File

@ -63,7 +63,7 @@ static void
rtree_delete_subtree(rtree_t *rtree, rtree_node_elm_t *node, unsigned level) rtree_delete_subtree(rtree_t *rtree, rtree_node_elm_t *node, unsigned level)
{ {
if (level < rtree->height - 1) { if (level + 1 < rtree->height) {
size_t nchildren, i; size_t nchildren, i;
nchildren = ZU(1) << rtree->levels[level].bits; nchildren = ZU(1) << rtree->levels[level].bits;