-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
921fbab
commit b5ccde1
Showing
5 changed files
with
152 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace LibHac.Common.FixedArrays; | ||
|
||
[StructLayout(LayoutKind.Sequential)] | ||
public struct Array6<T> | ||
{ | ||
public const int Length = 6; | ||
|
||
private T _1; | ||
private T _2; | ||
private T _3; | ||
private T _4; | ||
private T _5; | ||
private T _6; | ||
|
||
public ref T this[int i] => ref Items[i]; | ||
|
||
public Span<T> Items => SpanHelpers.CreateSpan(ref _1, Length); | ||
public readonly ReadOnlySpan<T> ItemsRo => SpanHelpers.CreateReadOnlySpan(in _1, Length); | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public static implicit operator ReadOnlySpan<T>(in Array6<T> value) => value.ItemsRo; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters