提交 629bd9a9 创建 作者: David Benjamin's avatar David Benjamin

Fix descent into unnecessary indices

上级 89c11d1a
...@@ -78,9 +78,9 @@ update_range(radix_entry cur, radix_ptr *ptr, CB cb, ...@@ -78,9 +78,9 @@ update_range(radix_entry cur, radix_ptr *ptr, CB cb,
u64 start, u64 end, u32 level = radix_levels) u64 start, u64 end, u32 level = radix_levels)
{ {
assert(level_size(level) == cur_end - cur_start); assert(level_size(level) == cur_end - cur_start);
// If ranges are disjoint, do nothing. // Assert that our ranges intersect; if this fails, we got the loop
if (cur_start >= end || start >= cur_end) // below wrong.
return; assert(cur_start < end && start < cur_end)
// If our range is not strictly contained in the target, ensure we // If our range is not strictly contained in the target, ensure we
// are at a node. // are at a node.
...@@ -96,7 +96,7 @@ update_range(radix_entry cur, radix_ptr *ptr, CB cb, ...@@ -96,7 +96,7 @@ update_range(radix_entry cur, radix_ptr *ptr, CB cb,
int i = index(start, level - 1); int i = index(start, level - 1);
u64 child_size = (cur_end - cur_start) >> bits_per_level; u64 child_size = (cur_end - cur_start) >> bits_per_level;
u64 child_start = cur_start + i * child_size; u64 child_start = cur_start + i * child_size;
for (; (i < (1<<bits_per_level)) && (child_start < cur_end); for (; (i < (1<<bits_per_level)) && (child_start < end);
i++, child_start += child_size) { i++, child_start += child_size) {
radix_ptr *child = &cur.node()->child[i]; radix_ptr *child = &cur.node()->child[i];
update_range(child->load(), child, cb, update_range(child->load(), child, cb,
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论