Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,20 @@ internal ref readonly T ItemRef(int index)
{
Requires.Range(index >= 0 && index < this.Count, nameof(index));

return ref ItemRefUnchecked(index);
}

private ref readonly T ItemRefUnchecked(int index)
{
Debug.Assert(_left != null && _right != null);
if (index < _left._count)
{
return ref _left.ItemRef(index);
return ref _left.ItemRefUnchecked(index);
}

if (index > _left._count)
{
return ref _right.ItemRef(index - _left._count - 1);
return ref _right.ItemRefUnchecked(index - _left._count - 1);
}

return ref _key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,22 @@ internal T this[int index]
internal ref readonly T ItemRef(int index)
{
Requires.Range(index >= 0 && index < this.Count, nameof(index));

return ref ItemRefUnchecked(index);
}

private ref readonly T ItemRefUnchecked(int index)
{
Debug.Assert(_left != null && _right != null);

if (index < _left._count)
{
return ref _left.ItemRef(index);
return ref _left.ItemRefUnchecked(index);
}

if (index > _left._count)
{
return ref _right.ItemRef(index - _left._count - 1);
return ref _right.ItemRefUnchecked(index - _left._count - 1);
}

return ref _key;
Expand Down