Skip to content
Closed
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 @@ -375,13 +375,15 @@ private unsafe nint GetFlattenedIndex(ReadOnlySpan<int> indices)

public unsafe int Rank
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
int rank = RuntimeHelpers.GetMultiDimensionalArrayRank(this);
return (rank != 0) ? rank : 1;
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe int GetLength(int dimension)
{
int rank = RuntimeHelpers.GetMultiDimensionalArrayRank(this);
Expand All @@ -394,6 +396,7 @@ public unsafe int GetLength(int dimension)
return Unsafe.Add(ref RuntimeHelpers.GetMultiDimensionalArrayBounds(this), dimension);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe int GetUpperBound(int dimension)
{
int rank = RuntimeHelpers.GetMultiDimensionalArrayRank(this);
Expand All @@ -407,6 +410,7 @@ public unsafe int GetUpperBound(int dimension)
return Unsafe.Add(ref bounds, dimension) + Unsafe.Add(ref bounds, rank + dimension) - 1;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe int GetLowerBound(int dimension)
{
int rank = RuntimeHelpers.GetMultiDimensionalArrayRank(this);
Expand Down