mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Use inline arrays
This commit is contained in:
parent
48e7651291
commit
f19b219e84
100 changed files with 292 additions and 1914 deletions
|
@ -103,46 +103,46 @@ public static class KeysCodeGen
|
|||
RSAParameters betaNca0Params =
|
||||
Rsa.RecoverParameters(BetaNca0Modulus, StandardPublicExponent, BetaNca0Exponent);
|
||||
|
||||
betaNca0Params.D.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.PrivateExponent.Items);
|
||||
betaNca0Params.DP.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.Dp.Items);
|
||||
betaNca0Params.DQ.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.Dq.Items);
|
||||
betaNca0Params.Exponent.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.PublicExponent.Items);
|
||||
betaNca0Params.InverseQ.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.InverseQ.Items);
|
||||
betaNca0Params.Modulus.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.Modulus.Items);
|
||||
betaNca0Params.P.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.P.Items);
|
||||
betaNca0Params.Q.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.Q.Items);
|
||||
betaNca0Params.D.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.PrivateExponent);
|
||||
betaNca0Params.DP.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.Dp);
|
||||
betaNca0Params.DQ.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.Dq);
|
||||
betaNca0Params.Exponent.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.PublicExponent);
|
||||
betaNca0Params.InverseQ.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.InverseQ);
|
||||
betaNca0Params.Modulus.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.Modulus);
|
||||
betaNca0Params.P.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.P);
|
||||
betaNca0Params.Q.AsSpan().CopyTo(keySet.BetaNca0KeyAreaKey.Q);
|
||||
|
||||
// First populate the prod RSA keys
|
||||
keySet.SetMode(KeySet.Mode.Prod);
|
||||
|
||||
StandardPublicExponent.CopyTo(keySet.NcaHeaderSigningKeys[0].PublicExponent.Items);
|
||||
StandardPublicExponent.CopyTo(keySet.NcaHeaderSigningKeys[1].PublicExponent.Items);
|
||||
NcaHdrFixedKeyModulus0Prod.CopyTo(keySet.NcaHeaderSigningKeys[0].Modulus.Items);
|
||||
NcaHdrFixedKeyModulus1Prod.CopyTo(keySet.NcaHeaderSigningKeys[1].Modulus.Items);
|
||||
StandardPublicExponent.CopyTo(keySet.NcaHeaderSigningKeys[0].PublicExponent);
|
||||
StandardPublicExponent.CopyTo(keySet.NcaHeaderSigningKeys[1].PublicExponent);
|
||||
NcaHdrFixedKeyModulus0Prod.CopyTo(keySet.NcaHeaderSigningKeys[0].Modulus);
|
||||
NcaHdrFixedKeyModulus1Prod.CopyTo(keySet.NcaHeaderSigningKeys[1].Modulus);
|
||||
|
||||
StandardPublicExponent.CopyTo(keySet.AcidSigningKeys[0].PublicExponent.Items);
|
||||
StandardPublicExponent.CopyTo(keySet.AcidSigningKeys[1].PublicExponent.Items);
|
||||
AcidFixedKeyModulus0Prod.CopyTo(keySet.AcidSigningKeys[0].Modulus.Items);
|
||||
AcidFixedKeyModulus1Prod.CopyTo(keySet.AcidSigningKeys[1].Modulus.Items);
|
||||
StandardPublicExponent.CopyTo(keySet.AcidSigningKeys[0].PublicExponent);
|
||||
StandardPublicExponent.CopyTo(keySet.AcidSigningKeys[1].PublicExponent);
|
||||
AcidFixedKeyModulus0Prod.CopyTo(keySet.AcidSigningKeys[0].Modulus);
|
||||
AcidFixedKeyModulus1Prod.CopyTo(keySet.AcidSigningKeys[1].Modulus);
|
||||
|
||||
StandardPublicExponent.CopyTo(keySet.Package2SigningKey.PublicExponent.Items);
|
||||
Package2FixedKeyModulusProd.CopyTo(keySet.Package2SigningKey.Modulus.Items);
|
||||
StandardPublicExponent.CopyTo(keySet.Package2SigningKey.PublicExponent);
|
||||
Package2FixedKeyModulusProd.CopyTo(keySet.Package2SigningKey.Modulus);
|
||||
|
||||
// Populate the dev RSA keys
|
||||
keySet.SetMode(KeySet.Mode.Dev);
|
||||
|
||||
StandardPublicExponent.CopyTo(keySet.NcaHeaderSigningKeys[0].PublicExponent.Items);
|
||||
StandardPublicExponent.CopyTo(keySet.NcaHeaderSigningKeys[1].PublicExponent.Items);
|
||||
NcaHdrFixedKeyModulus0Dev.CopyTo(keySet.NcaHeaderSigningKeys[0].Modulus.Items);
|
||||
NcaHdrFixedKeyModulus1Dev.CopyTo(keySet.NcaHeaderSigningKeys[1].Modulus.Items);
|
||||
StandardPublicExponent.CopyTo(keySet.NcaHeaderSigningKeys[0].PublicExponent);
|
||||
StandardPublicExponent.CopyTo(keySet.NcaHeaderSigningKeys[1].PublicExponent);
|
||||
NcaHdrFixedKeyModulus0Dev.CopyTo(keySet.NcaHeaderSigningKeys[0].Modulus);
|
||||
NcaHdrFixedKeyModulus1Dev.CopyTo(keySet.NcaHeaderSigningKeys[1].Modulus);
|
||||
|
||||
StandardPublicExponent.CopyTo(keySet.AcidSigningKeys[0].PublicExponent.Items);
|
||||
StandardPublicExponent.CopyTo(keySet.AcidSigningKeys[1].PublicExponent.Items);
|
||||
AcidFixedKeyModulus0Dev.CopyTo(keySet.AcidSigningKeys[0].Modulus.Items);
|
||||
AcidFixedKeyModulus1Dev.CopyTo(keySet.AcidSigningKeys[1].Modulus.Items);
|
||||
StandardPublicExponent.CopyTo(keySet.AcidSigningKeys[0].PublicExponent);
|
||||
StandardPublicExponent.CopyTo(keySet.AcidSigningKeys[1].PublicExponent);
|
||||
AcidFixedKeyModulus0Dev.CopyTo(keySet.AcidSigningKeys[0].Modulus);
|
||||
AcidFixedKeyModulus1Dev.CopyTo(keySet.AcidSigningKeys[1].Modulus);
|
||||
|
||||
StandardPublicExponent.CopyTo(keySet.Package2SigningKey.PublicExponent.Items);
|
||||
Package2FixedKeyModulusDev.CopyTo(keySet.Package2SigningKey.Modulus.Items);
|
||||
StandardPublicExponent.CopyTo(keySet.Package2SigningKey.PublicExponent);
|
||||
Package2FixedKeyModulusDev.CopyTo(keySet.Package2SigningKey.Modulus);
|
||||
|
||||
return keySet;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ public struct Digest
|
|||
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return Value.ItemsRo.ToHexString();
|
||||
return Value[..].ToHexString();
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ public struct DirectoryName
|
|||
|
||||
public readonly bool IsValid()
|
||||
{
|
||||
ReadOnlySpan<byte> name = Value.ItemsRo;
|
||||
ReadOnlySpan<byte> name = Value;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < name.Length; i++)
|
||||
|
@ -32,6 +32,6 @@ public struct DirectoryName
|
|||
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return StringUtils.Utf8ZToString(Value.ItemsRo);
|
||||
return StringUtils.Utf8ZToString(Value);
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ public struct FileName
|
|||
|
||||
public readonly bool IsValid()
|
||||
{
|
||||
ReadOnlySpan<byte> name = Value.ItemsRo;
|
||||
ReadOnlySpan<byte> name = Value;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < name.Length; i++)
|
||||
|
@ -35,6 +35,6 @@ public struct FileName
|
|||
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return StringUtils.Utf8ZToString(Value.ItemsRo);
|
||||
return StringUtils.Utf8ZToString(Value);
|
||||
}
|
||||
}
|
|
@ -76,7 +76,7 @@ internal class DeliveryCacheStorageService : IDeliveryCacheStorageService
|
|||
break;
|
||||
}
|
||||
|
||||
StringUtils.Copy(nameBuffer[i].Value.Items, entry.Name.Value);
|
||||
StringUtils.Copy(nameBuffer[i].Value, entry.Name.Value);
|
||||
}
|
||||
|
||||
namesRead = i;
|
||||
|
|
|
@ -39,7 +39,7 @@ public struct Package1MetaData
|
|||
public byte Version;
|
||||
|
||||
[UnscopedRef] public U8Span BuildDate => new U8Span(_buildDate);
|
||||
[UnscopedRef] public ReadOnlySpan<byte> Iv => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_buildDate.Items), 0x10);
|
||||
[UnscopedRef] public ReadOnlySpan<byte> Iv => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_buildDate[..]), 0x10);
|
||||
}
|
||||
|
||||
public struct Package1Stage1Footer
|
||||
|
@ -283,7 +283,7 @@ public class Package1
|
|||
|
||||
private Result ReadModernEristaMac()
|
||||
{
|
||||
return _baseStorage.Get.Read(ModernStage1Size + Pk11Size, _pk11Mac.Items);
|
||||
return _baseStorage.Get.Read(ModernStage1Size + Pk11Size, _pk11Mac);
|
||||
}
|
||||
|
||||
private Result SetPk11Storage()
|
||||
|
@ -319,7 +319,7 @@ public class Package1
|
|||
else
|
||||
{
|
||||
decPk11Storage = new Aes128CtrStorage(encPk11Storage,
|
||||
KeySet.Package1Keys[KeyRevision].DataRo.ToArray(), _stage1Footer.Iv.ItemsRo.ToArray(), true);
|
||||
KeySet.Package1Keys[KeyRevision].DataRo.ToArray(), _stage1Footer.Iv[..].ToArray(), true);
|
||||
}
|
||||
|
||||
_pk11Storage = new SubStorage(new CachedStorage(decPk11Storage, 0x4000, 1, true), 0, Pk11Size);
|
||||
|
@ -383,7 +383,7 @@ public class Package1
|
|||
// MarikoOemHeader must be read first
|
||||
private bool IsMarikoImpl()
|
||||
{
|
||||
return MarikoOemHeader.AesMac.ItemsRo.IsZeros() && MarikoOemHeader.Reserved.ItemsRo.IsZeros();
|
||||
return MarikoOemHeader.AesMac[..].IsZeros() && MarikoOemHeader.Reserved[..].IsZeros();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -416,7 +416,7 @@ public class Package1
|
|||
|
||||
if (IsModern)
|
||||
{
|
||||
storages.Add(new MemoryStorage(_pk11Mac.ItemsRo.ToArray()));
|
||||
storages.Add(new MemoryStorage(_pk11Mac[..].ToArray()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class Package2StorageReader : IDisposable
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
byte[] iv = _header.Meta.PayloadIvs[index].ItemsRo.ToArray();
|
||||
byte[] iv = _header.Meta.PayloadIvs[index][..].ToArray();
|
||||
outPayloadStorage.Reset(new CachedStorage(new Aes128CtrStorage(payloadSubStorage, _key.DataRo.ToArray(), iv, true), 0x4000, 1, true));
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ public class Package2StorageReader : IDisposable
|
|||
|
||||
// The counter starts counting at the beginning of the meta struct, but the first block in
|
||||
// the struct isn't encrypted. Increase the counter by one to skip that block.
|
||||
byte[] iv = _header.Meta.HeaderIv.ItemsRo.ToArray();
|
||||
byte[] iv = _header.Meta.HeaderIv[..].ToArray();
|
||||
Utilities.IncrementByteArray(iv);
|
||||
|
||||
storages.Add(new CachedStorage(new Aes128CtrStorage(encMetaStorage, _key.DataRo.ToArray(), iv, true), 0x100, 1, true));
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array1<T>
|
||||
{
|
||||
public const int Length = 1;
|
||||
|
||||
private T _0;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef] public Span<T> Items => SpanHelpers.CreateSpan(ref _0, Length);
|
||||
[UnscopedRef] public readonly ReadOnlySpan<T> ItemsRo => SpanHelpers.CreateReadOnlySpan(in _0, Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array1<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array100<T>
|
||||
{
|
||||
public const int Length = 100;
|
||||
|
||||
private Array64<T> _0;
|
||||
private Array36<T> _64;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array100<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array1024<T>
|
||||
{
|
||||
public const int Length = 1024;
|
||||
|
||||
private Array512<T> _0;
|
||||
private Array512<T> _512;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array1024<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array11<T>
|
||||
{
|
||||
public const int Length = 11;
|
||||
|
||||
private T _0;
|
||||
private T _1;
|
||||
private T _2;
|
||||
private T _3;
|
||||
private T _4;
|
||||
private T _5;
|
||||
private T _6;
|
||||
private T _7;
|
||||
private T _8;
|
||||
private T _9;
|
||||
private T _10;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef] public Span<T> Items => SpanHelpers.CreateSpan(ref _0, Length);
|
||||
[UnscopedRef] public readonly ReadOnlySpan<T> ItemsRo => SpanHelpers.CreateReadOnlySpan(in _0, Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array11<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array112<T>
|
||||
{
|
||||
public const int Length = 112;
|
||||
|
||||
private Array80<T> _0;
|
||||
private Array32<T> _80;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array112<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array12<T>
|
||||
{
|
||||
public const int Length = 12;
|
||||
|
||||
private T _0;
|
||||
private T _1;
|
||||
private T _2;
|
||||
private T _3;
|
||||
private T _4;
|
||||
private T _5;
|
||||
private T _6;
|
||||
private T _7;
|
||||
private T _8;
|
||||
private T _9;
|
||||
private T _10;
|
||||
private T _11;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef] public Span<T> Items => SpanHelpers.CreateSpan(ref _0, Length);
|
||||
[UnscopedRef] public readonly ReadOnlySpan<T> ItemsRo => SpanHelpers.CreateReadOnlySpan(in _0, Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array12<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array128<T>
|
||||
{
|
||||
public const int Length = 128;
|
||||
|
||||
private Array64<T> _0;
|
||||
private Array64<T> _64;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array128<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array14<T>
|
||||
{
|
||||
public const int Length = 14;
|
||||
|
||||
private Array8<T> _0;
|
||||
private Array6<T> _8;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array14<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array144<T>
|
||||
{
|
||||
public const int Length = 144;
|
||||
|
||||
private Array128<T> _0;
|
||||
private Array16<T> _128;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array144<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array15<T>
|
||||
{
|
||||
public const int Length = 15;
|
||||
|
||||
private Array8<T> _0;
|
||||
private Array7<T> _8;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array15<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array16<T>
|
||||
{
|
||||
public const int Length = 16;
|
||||
|
||||
private Array8<T> _0;
|
||||
private Array8<T> _8;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array16<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array16384<T>
|
||||
{
|
||||
public const int Length = 16384;
|
||||
|
||||
private Array8192<T> _0;
|
||||
private Array8192<T> _8192;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array16384<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array18<T>
|
||||
{
|
||||
public const int Length = 18;
|
||||
|
||||
private Array16<T> _0;
|
||||
private Array2<T> _16;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array18<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array192<T>
|
||||
{
|
||||
public const int Length = 192;
|
||||
|
||||
private Array128<T> _0;
|
||||
private Array64<T> _128;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array192<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array2<T>
|
||||
{
|
||||
public const int Length = 2;
|
||||
|
||||
private T _0;
|
||||
private T _1;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef] public Span<T> Items => SpanHelpers.CreateSpan(ref _0, Length);
|
||||
[UnscopedRef] public readonly ReadOnlySpan<T> ItemsRo => SpanHelpers.CreateReadOnlySpan(in _0, Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array2<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array20<T>
|
||||
{
|
||||
public const int Length = 20;
|
||||
|
||||
private Array16<T> _0;
|
||||
private Array4<T> _16;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array20<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array2048<T>
|
||||
{
|
||||
public const int Length = 2048;
|
||||
|
||||
private Array1024<T> _0;
|
||||
private Array1024<T> _1024;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array2048<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array24<T>
|
||||
{
|
||||
public const int Length = 24;
|
||||
|
||||
private Array16<T> _0;
|
||||
private Array8<T> _16;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array24<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array256<T>
|
||||
{
|
||||
public const int Length = 256;
|
||||
|
||||
private Array128<T> _0;
|
||||
private Array128<T> _128;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array256<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array26<T>
|
||||
{
|
||||
public const int Length = 26;
|
||||
|
||||
private Array16<T> _0;
|
||||
private Array8<T> _16;
|
||||
private Array2<T> _24;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array26<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array27<T>
|
||||
{
|
||||
public const int Length = 27;
|
||||
|
||||
private Array16<T> _0;
|
||||
private Array8<T> _16;
|
||||
private Array2<T> _24;
|
||||
private T _26;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array27<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array28<T>
|
||||
{
|
||||
public const int Length = 28;
|
||||
|
||||
private Array16<T> _0;
|
||||
private Array8<T> _16;
|
||||
private Array4<T> _24;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array28<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array3<T>
|
||||
{
|
||||
public const int Length = 3;
|
||||
|
||||
private T _0;
|
||||
private T _1;
|
||||
private T _2;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef] public Span<T> Items => SpanHelpers.CreateSpan(ref _0, Length);
|
||||
[UnscopedRef] public readonly ReadOnlySpan<T> ItemsRo => SpanHelpers.CreateReadOnlySpan(in _0, Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array3<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array3000<T>
|
||||
{
|
||||
public const int Length = 3000;
|
||||
|
||||
private Array2048<T> _0;
|
||||
private Array512<T> _2048;
|
||||
private Array256<T> _2560;
|
||||
private Array128<T> _2816;
|
||||
private Array56<T> _2944;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array3000<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array32<T>
|
||||
{
|
||||
public const int Length = 32;
|
||||
|
||||
private Array16<T> _0;
|
||||
private Array16<T> _16;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array32<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array356<T>
|
||||
{
|
||||
public const int Length = 356;
|
||||
|
||||
private Array256<T> _0;
|
||||
private Array64<T> _256;
|
||||
private Array32<T> _320;
|
||||
private Array4<T> _352;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array356<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array36<T>
|
||||
{
|
||||
public const int Length = 36;
|
||||
|
||||
private Array32<T> _0;
|
||||
private Array4<T> _32;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array36<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array37<T>
|
||||
{
|
||||
public const int Length = 37;
|
||||
|
||||
private Array32<T> _0;
|
||||
private Array5<T> _32;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array37<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array38<T>
|
||||
{
|
||||
public const int Length = 38;
|
||||
|
||||
private Array32<T> _0;
|
||||
private Array6<T> _32;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array38<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array4<T>
|
||||
{
|
||||
public const int Length = 4;
|
||||
|
||||
private T _0;
|
||||
private T _1;
|
||||
private T _2;
|
||||
private T _3;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef] public Span<T> Items => SpanHelpers.CreateSpan(ref _0, Length);
|
||||
[UnscopedRef] public readonly ReadOnlySpan<T> ItemsRo => SpanHelpers.CreateReadOnlySpan(in _0, Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array4<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array400<T>
|
||||
{
|
||||
public const int Length = 400;
|
||||
|
||||
private Array256<T> _0;
|
||||
private Array128<T> _256;
|
||||
private Array16<T> _384;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array400<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array4096<T>
|
||||
{
|
||||
public const int Length = 4096;
|
||||
|
||||
private Array2048<T> _0;
|
||||
private Array2048<T> _2048;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array4096<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array436<T>
|
||||
{
|
||||
public const int Length = 436;
|
||||
|
||||
private Array256<T> _0;
|
||||
private Array128<T> _256;
|
||||
private Array32<T> _384;
|
||||
private Array20<T> _416;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array436<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array452<T>
|
||||
{
|
||||
public const int Length = 452;
|
||||
|
||||
private Array256<T> _0;
|
||||
private Array128<T> _256;
|
||||
private Array64<T> _384;
|
||||
private Array4<T> _448;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array452<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array464<T>
|
||||
{
|
||||
public const int Length = 464;
|
||||
|
||||
private Array256<T> _0;
|
||||
private Array128<T> _256;
|
||||
private Array64<T> _384;
|
||||
private Array16<T> _448;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array464<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array48<T>
|
||||
{
|
||||
public const int Length = 48;
|
||||
|
||||
private Array32<T> _0;
|
||||
private Array16<T> _32;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array48<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array5<T>
|
||||
{
|
||||
public const int Length = 5;
|
||||
|
||||
private T _0;
|
||||
private T _1;
|
||||
private T _2;
|
||||
private T _3;
|
||||
private T _4;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef] public Span<T> Items => SpanHelpers.CreateSpan(ref _0, Length);
|
||||
[UnscopedRef] public readonly ReadOnlySpan<T> ItemsRo => SpanHelpers.CreateReadOnlySpan(in _0, Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array5<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array512<T>
|
||||
{
|
||||
public const int Length = 512;
|
||||
|
||||
private Array256<T> _0;
|
||||
private Array256<T> _256;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array512<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array56<T>
|
||||
{
|
||||
public const int Length = 56;
|
||||
|
||||
private Array32<T> _0;
|
||||
private Array24<T> _32;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array56<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array6<T>
|
||||
{
|
||||
public const int Length = 6;
|
||||
|
||||
private T _0;
|
||||
private T _1;
|
||||
private T _2;
|
||||
private T _3;
|
||||
private T _4;
|
||||
private T _5;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef] public Span<T> Items => SpanHelpers.CreateSpan(ref _0, Length);
|
||||
[UnscopedRef] public readonly ReadOnlySpan<T> ItemsRo => SpanHelpers.CreateReadOnlySpan(in _0, Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array6<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array60<T>
|
||||
{
|
||||
public const int Length = 60;
|
||||
|
||||
private Array32<T> _0;
|
||||
private Array16<T> _32;
|
||||
private Array12<T> _48;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array60<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array64<T>
|
||||
{
|
||||
public const int Length = 64;
|
||||
|
||||
private Array32<T> _0;
|
||||
private Array32<T> _32;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array64<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array65<T>
|
||||
{
|
||||
public const int Length = 65;
|
||||
|
||||
private Array64<T> _0;
|
||||
private T _64;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array65<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array68<T>
|
||||
{
|
||||
public const int Length = 68;
|
||||
|
||||
private Array64<T> _0;
|
||||
private Array4<T> _64;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array68<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array7<T>
|
||||
{
|
||||
public const int Length = 7;
|
||||
|
||||
private T _0;
|
||||
private T _1;
|
||||
private T _2;
|
||||
private T _3;
|
||||
private T _4;
|
||||
private T _5;
|
||||
private T _6;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef] public Span<T> Items => SpanHelpers.CreateSpan(ref _0, Length);
|
||||
[UnscopedRef] public readonly ReadOnlySpan<T> ItemsRo => SpanHelpers.CreateReadOnlySpan(in _0, Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array7<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array768<T>
|
||||
{
|
||||
public const int Length = 768;
|
||||
|
||||
private Array512<T> _0;
|
||||
private Array256<T> _512;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array768<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array769<T>
|
||||
{
|
||||
public const int Length = 769;
|
||||
|
||||
private Array512<T> _0;
|
||||
private Array256<T> _512;
|
||||
private Array1<T> _768;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array769<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array8<T>
|
||||
{
|
||||
public const int Length = 8;
|
||||
|
||||
private T _0;
|
||||
private T _1;
|
||||
private T _2;
|
||||
private T _3;
|
||||
private T _4;
|
||||
private T _5;
|
||||
private T _6;
|
||||
private T _7;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef] public Span<T> Items => SpanHelpers.CreateSpan(ref _0, Length);
|
||||
[UnscopedRef] public readonly ReadOnlySpan<T> ItemsRo => SpanHelpers.CreateReadOnlySpan(in _0, Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array8<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array80<T>
|
||||
{
|
||||
public const int Length = 80;
|
||||
|
||||
private Array64<T> _0;
|
||||
private Array16<T> _64;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array80<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array8192<T>
|
||||
{
|
||||
public const int Length = 8192;
|
||||
|
||||
private Array4096<T> _0;
|
||||
private Array4096<T> _4096;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array8192<T> value) => value.ItemsRo;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma warning disable CS0169, CS0649, IDE0051 // Field is never used, Field is never assigned to, Remove unused private members
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
public struct Array96<T>
|
||||
{
|
||||
public const int Length = 96;
|
||||
|
||||
private Array80<T> _0;
|
||||
private Array16<T> _80;
|
||||
|
||||
[UnscopedRef] public ref T this[int i] => ref Items[i];
|
||||
|
||||
[UnscopedRef]
|
||||
public Span<T> Items
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.Items), Length);
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ReadOnlySpan<T> ItemsRo
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SpanHelpers.CreateSpan(ref MemoryMarshal.GetReference(_0.ItemsRo), Length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator ReadOnlySpan<T>(in Array96<T> value) => value.ItemsRo;
|
||||
}
|
50
src/LibHac/Common/FixedArrays/Arrays.cs
Normal file
50
src/LibHac/Common/FixedArrays/Arrays.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common.FixedArrays;
|
||||
|
||||
[InlineArray(1)] public struct Array1<T> { public readonly int Length => 1; private T _0; }
|
||||
[InlineArray(2)] public struct Array2<T> { public readonly int Length => 2; private T _0; }
|
||||
[InlineArray(3)] public struct Array3<T> { public readonly int Length => 3; private T _0; }
|
||||
[InlineArray(4)] public struct Array4<T> { public readonly int Length => 4; private T _0; }
|
||||
[InlineArray(5)] public struct Array5<T> { public readonly int Length => 5; private T _0; }
|
||||
[InlineArray(6)] public struct Array6<T> { public readonly int Length => 6; private T _0; }
|
||||
[InlineArray(7)] public struct Array7<T> { public readonly int Length => 7; private T _0; }
|
||||
[InlineArray(8)] public struct Array8<T> { public readonly int Length => 8; private T _0; }
|
||||
[InlineArray(11)] public struct Array11<T> { public readonly int Length => 11; private T _0; }
|
||||
[InlineArray(12)] public struct Array12<T> { public readonly int Length => 12; private T _0; }
|
||||
[InlineArray(14)] public struct Array14<T> { public readonly int Length => 14; private T _0; }
|
||||
[InlineArray(15)] public struct Array15<T> { public readonly int Length => 15; private T _0; }
|
||||
[InlineArray(16)] public struct Array16<T> { public readonly int Length => 16; private T _0; }
|
||||
[InlineArray(18)] public struct Array18<T> { public readonly int Length => 18; private T _0; }
|
||||
[InlineArray(20)] public struct Array20<T> { public readonly int Length => 20; private T _0; }
|
||||
[InlineArray(24)] public struct Array24<T> { public readonly int Length => 24; private T _0; }
|
||||
[InlineArray(26)] public struct Array26<T> { public readonly int Length => 26; private T _0; }
|
||||
[InlineArray(27)] public struct Array27<T> { public readonly int Length => 27; private T _0; }
|
||||
[InlineArray(28)] public struct Array28<T> { public readonly int Length => 28; private T _0; }
|
||||
[InlineArray(32)] public struct Array32<T> { public readonly int Length => 32; private T _0; }
|
||||
[InlineArray(36)] public struct Array36<T> { public readonly int Length => 36; private T _0; }
|
||||
[InlineArray(37)] public struct Array37<T> { public readonly int Length => 37; private T _0; }
|
||||
[InlineArray(38)] public struct Array38<T> { public readonly int Length => 38; private T _0; }
|
||||
[InlineArray(48)] public struct Array48<T> { public readonly int Length => 48; private T _0; }
|
||||
[InlineArray(56)] public struct Array56<T> { public readonly int Length => 56; private T _0; }
|
||||
[InlineArray(60)] public struct Array60<T> { public readonly int Length => 60; private T _0; }
|
||||
[InlineArray(64)] public struct Array64<T> { public readonly int Length => 64; private T _0; }
|
||||
[InlineArray(65)] public struct Array65<T> { public readonly int Length => 65; private T _0; }
|
||||
[InlineArray(68)] public struct Array68<T> { public readonly int Length => 68; private T _0; }
|
||||
[InlineArray(100)] public struct Array100<T> { public readonly int Length => 100; private T _0; }
|
||||
[InlineArray(112)] public struct Array112<T> { public readonly int Length => 112; private T _0; }
|
||||
[InlineArray(128)] public struct Array128<T> { public readonly int Length => 128; private T _0; }
|
||||
[InlineArray(144)] public struct Array144<T> { public readonly int Length => 144; private T _0; }
|
||||
[InlineArray(192)] public struct Array192<T> { public readonly int Length => 192; private T _0; }
|
||||
[InlineArray(256)] public struct Array256<T> { public readonly int Length => 256; private T _0; }
|
||||
[InlineArray(356)] public struct Array356<T> { public readonly int Length => 356; private T _0; }
|
||||
[InlineArray(400)] public struct Array400<T> { public readonly int Length => 400; private T _0; }
|
||||
[InlineArray(436)] public struct Array436<T> { public readonly int Length => 436; private T _0; }
|
||||
[InlineArray(452)] public struct Array452<T> { public readonly int Length => 452; private T _0; }
|
||||
[InlineArray(464)] public struct Array464<T> { public readonly int Length => 464; private T _0; }
|
||||
[InlineArray(512)] public struct Array512<T> { public readonly int Length => 512; private T _0; }
|
||||
[InlineArray(768)] public struct Array768<T> { public readonly int Length => 768; private T _0; }
|
||||
[InlineArray(769)] public struct Array769<T> { public readonly int Length => 769; private T _0; }
|
||||
[InlineArray(3000)] public struct Array3000<T> { public readonly int Length => 3000; private T _0; }
|
||||
[InlineArray(8192)] public struct Array8192<T> { public readonly int Length => 8192; private T _0; }
|
||||
[InlineArray(16384)] public struct Array16384<T> { public readonly int Length => 16384; private T _0; }
|
|
@ -54,37 +54,37 @@ public class KeySet
|
|||
|
||||
public ExternalKeySet ExternalKeySet { get; } = new ExternalKeySet();
|
||||
|
||||
public Span<AesKey> MarikoAesClassKeys => RootKeys.MarikoAesClassKeys.Items;
|
||||
public Span<AesKey> MarikoAesClassKeys => RootKeys.MarikoAesClassKeys;
|
||||
public ref AesKey MarikoKek => ref RootKeys.MarikoKek;
|
||||
public ref AesKey MarikoBek => ref RootKeys.MarikoBek;
|
||||
public Span<KeyBlob> KeyBlobs => RootKeys.KeyBlobs.Items;
|
||||
public Span<AesKey> KeyBlobKeySources => _keys.KeySeeds.KeyBlobKeySources.Items;
|
||||
public Span<KeyBlob> KeyBlobs => RootKeys.KeyBlobs;
|
||||
public Span<AesKey> KeyBlobKeySources => _keys.KeySeeds.KeyBlobKeySources;
|
||||
public ref AesKey KeyBlobMacKeySource => ref _keys.KeySeeds.KeyBlobMacKeySource;
|
||||
|
||||
public Span<AesKey> TsecSecrets => Secrets.Secrets.Items;
|
||||
public Span<AesKey> TsecRootKeks => RootKeys.TsecRootKeks.Items;
|
||||
public Span<AesKey> Package1MacKeks => RootKeys.Package1MacKeks.Items;
|
||||
public Span<AesKey> Package1Keks => RootKeys.Package1Keks.Items;
|
||||
public Span<AesKey> TsecAuthSignatures => _keys.KeySeeds.TsecAuthSignatures.Items;
|
||||
public Span<AesKey> TsecRootKeys => RootKeys.TsecRootKeys.Items;
|
||||
public Span<AesKey> MasterKekSources => _keys.KeySeeds.MasterKekSources.Items;
|
||||
public Span<AesKey> GcTitleKeyKeks => RootKeys.GcTitleKeyKeks.Items;
|
||||
public Span<AesKey> TsecSecrets => Secrets.Secrets;
|
||||
public Span<AesKey> TsecRootKeks => RootKeys.TsecRootKeks;
|
||||
public Span<AesKey> Package1MacKeks => RootKeys.Package1MacKeks;
|
||||
public Span<AesKey> Package1Keks => RootKeys.Package1Keks;
|
||||
public Span<AesKey> TsecAuthSignatures => _keys.KeySeeds.TsecAuthSignatures;
|
||||
public Span<AesKey> TsecRootKeys => RootKeys.TsecRootKeys;
|
||||
public Span<AesKey> MasterKekSources => _keys.KeySeeds.MasterKekSources;
|
||||
public Span<AesKey> GcTitleKeyKeks => RootKeys.GcTitleKeyKeks;
|
||||
|
||||
public Span<AesKey> MarikoMasterKekSources => _mode == Mode.Dev
|
||||
? _keys.KeySeeds.MarikoMasterKekSourcesDev.Items
|
||||
: _keys.KeySeeds.MarikoMasterKekSources.Items;
|
||||
? _keys.KeySeeds.MarikoMasterKekSourcesDev[..]
|
||||
: _keys.KeySeeds.MarikoMasterKekSources[..];
|
||||
|
||||
public Span<AesKey> MasterKeks => DerivedKeys.MasterKeks.Items;
|
||||
public Span<AesKey> MasterKeks => DerivedKeys.MasterKeks;
|
||||
public ref AesKey MasterKeySource => ref _keys.KeySeeds.MasterKeySource;
|
||||
public Span<AesKey> MasterKeys => DerivedKeys.MasterKeys.Items;
|
||||
public Span<AesKey> Package1MacKeys => DerivedKeys.Package1MacKeys.Items;
|
||||
public Span<AesKey> Package1Keys => DerivedKeys.Package1Keys.Items;
|
||||
public Span<AesKey> Package2Keys => DerivedKeys.Package2Keys.Items;
|
||||
public Span<AesKey> MasterKeys => DerivedKeys.MasterKeys;
|
||||
public Span<AesKey> Package1MacKeys => DerivedKeys.Package1MacKeys;
|
||||
public Span<AesKey> Package1Keys => DerivedKeys.Package1Keys;
|
||||
public Span<AesKey> Package2Keys => DerivedKeys.Package2Keys;
|
||||
public ref AesKey Package2KeySource => ref _keys.KeySeeds.Package2KeySource;
|
||||
public ref AesKey PerConsoleKeySource => ref _keys.KeySeeds.PerConsoleKeySource;
|
||||
public ref AesKey RetailSpecificAesKeySource => ref _keys.KeySeeds.RetailSpecificAesKeySource;
|
||||
public ref AesKey BisKekSource => ref _keys.KeySeeds.BisKekSource;
|
||||
public Span<AesXtsKey> BisKeySources => _keys.KeySeeds.BisKeySources.Items;
|
||||
public Span<AesXtsKey> BisKeySources => _keys.KeySeeds.BisKeySources;
|
||||
public ref AesKey AesKekGenerationSource => ref _keys.KeySeeds.AesKekGenerationSource;
|
||||
public ref AesKey AesKeyGenerationSource => ref _keys.KeySeeds.AesKeyGenerationSource;
|
||||
public ref AesKey KeyAreaKeyApplicationSource => ref _keys.KeySeeds.KeyAreaKeyApplicationSource;
|
||||
|
@ -93,15 +93,15 @@ public class KeySet
|
|||
public ref AesKey TitleKekSource => ref _keys.KeySeeds.TitleKekSource;
|
||||
public ref AesKey HeaderKekSource => ref _keys.KeySeeds.HeaderKekSource;
|
||||
public ref AesKey SdCardKekSource => ref _keys.KeySeeds.SdCardKekSource;
|
||||
public Span<AesXtsKey> SdCardKeySources => _keys.KeySeeds.SdCardKeySources.Items;
|
||||
public Span<AesXtsKey> SdCardKeySources => _keys.KeySeeds.SdCardKeySources;
|
||||
public ref AesKey DeviceUniqueSaveMacKekSource => ref _keys.KeySeeds.DeviceUniqueSaveMacKekSource;
|
||||
public Span<AesKey> DeviceUniqueSaveMacKeySources => _keys.KeySeeds.DeviceUniqueSaveMacKeySources.Items;
|
||||
public Span<AesKey> DeviceUniqueSaveMacKeySources => _keys.KeySeeds.DeviceUniqueSaveMacKeySources;
|
||||
public ref AesKey SeedUniqueSaveMacKekSource => ref _keys.KeySeeds.SeedUniqueSaveMacKekSource;
|
||||
public ref AesKey SeedUniqueSaveMacKeySource => ref _keys.KeySeeds.SeedUniqueSaveMacKeySource;
|
||||
public ref AesXtsKey HeaderKeySource => ref _keys.KeySeeds.HeaderKeySource;
|
||||
public ref AesXtsKey HeaderKey => ref DerivedKeys.HeaderKey;
|
||||
public Span<AesKey> TitleKeks => DerivedKeys.TitleKeks.Items;
|
||||
public Span<Array3<AesKey>> KeyAreaKeys => DerivedKeys.KeyAreaKeys.Items;
|
||||
public Span<AesKey> TitleKeks => DerivedKeys.TitleKeks;
|
||||
public Span<Array3<AesKey>> KeyAreaKeys => DerivedKeys.KeyAreaKeys;
|
||||
public ref AesKey XciHeaderKey => ref StoredKeys.XciHeaderKey;
|
||||
public ref AesKey ETicketRsaKek => ref DerivedKeys.ETicketRsaKek;
|
||||
public ref AesKey SslRsaKek => ref DerivedKeys.SslRsaKek;
|
||||
|
@ -109,20 +109,20 @@ public class KeySet
|
|||
public ref AesKey SecureBootKey => ref _keys.DeviceKeys.SecureBootKey;
|
||||
public ref AesKey TsecKey => ref _keys.DeviceKeys.TsecKey;
|
||||
public ref AesKey SdCardEncryptionSeed => ref _keys.DeviceKeys.SdCardEncryptionSeed;
|
||||
public Span<EncryptedKeyBlob> EncryptedKeyBlobs => _keys.DeviceKeys.EncryptedKeyBlobs.Items;
|
||||
public Span<EncryptedKeyBlob> EncryptedKeyBlobs => _keys.DeviceKeys.EncryptedKeyBlobs;
|
||||
|
||||
public Span<AesKey> KeyBlobKeys => DerivedDeviceKeys.KeyBlobKeys.Items;
|
||||
public Span<AesKey> KeyBlobMacKeys => DerivedDeviceKeys.KeyBlobMacKeys.Items;
|
||||
public Span<AesKey> KeyBlobKeys => DerivedDeviceKeys.KeyBlobKeys;
|
||||
public Span<AesKey> KeyBlobMacKeys => DerivedDeviceKeys.KeyBlobMacKeys;
|
||||
public ref AesKey DeviceKey => ref DerivedDeviceKeys.DeviceKey;
|
||||
public Span<AesXtsKey> BisKeys => DerivedDeviceKeys.BisKeys.Items;
|
||||
public Span<AesKey> DeviceUniqueSaveMacKeys => DerivedDeviceKeys.DeviceUniqueSaveMacKeys.Items;
|
||||
public Span<AesXtsKey> BisKeys => DerivedDeviceKeys.BisKeys;
|
||||
public Span<AesKey> DeviceUniqueSaveMacKeys => DerivedDeviceKeys.DeviceUniqueSaveMacKeys;
|
||||
public ref AesKey SeedUniqueSaveMacKey => ref DerivedDeviceKeys.SeedUniqueSaveMacKey;
|
||||
|
||||
// Todo: Make a separate type? Not actually an AES-XTS key, but it's still the same shape.
|
||||
public Span<AesXtsKey> SdCardEncryptionKeys => DerivedDeviceKeys.SdCardEncryptionKeys.Items;
|
||||
public Span<AesXtsKey> SdCardEncryptionKeys => DerivedDeviceKeys.SdCardEncryptionKeys;
|
||||
|
||||
public Span<RsaKey> NcaHeaderSigningKeys => RsaSigningKeys.NcaHeaderSigningKeys.Items;
|
||||
public Span<RsaKey> AcidSigningKeys => RsaSigningKeys.AcidSigningKeys.Items;
|
||||
public Span<RsaKey> NcaHeaderSigningKeys => RsaSigningKeys.NcaHeaderSigningKeys;
|
||||
public Span<RsaKey> AcidSigningKeys => RsaSigningKeys.AcidSigningKeys;
|
||||
public ref RsaKey Package2SigningKey => ref RsaSigningKeys.Package2SigningKey;
|
||||
public ref RsaFullKey BetaNca0KeyAreaKey => ref RsaKeys.BetaNca0KeyAreaKey;
|
||||
public ref RsaKeyPair ETicketRsaKey => ref DeviceRsaKeys.ETicketRsaKey;
|
||||
|
@ -147,7 +147,7 @@ public class KeySet
|
|||
|
||||
// Todo: Remove local variable after Roslyn issue #67697 is fixed
|
||||
ref Array2<RSAParameters> array = ref keys.Value;
|
||||
return array.Items;
|
||||
return array;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class KeySet
|
|||
|
||||
// Todo: Remove local variable after Roslyn issue #67697 is fixed
|
||||
ref Array2<RSAParameters> array = ref keys.Value;
|
||||
return array.Items;
|
||||
return array;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ public class KeySet
|
|||
{
|
||||
ref Optional<RSAParameters> keys = ref _rsaKeyParams.ETicketRsaKey;
|
||||
|
||||
if (!keys.HasValue && !ETicketRsaKey.PublicExponent.ItemsRo.IsZeros())
|
||||
if (!keys.HasValue && !ETicketRsaKey.PublicExponent[..].IsZeros())
|
||||
{
|
||||
RSAParameters rsaParams = Rsa.RecoverParameters(ETicketRsaKey.Modulus, ETicketRsaKey.PublicExponent, ETicketRsaKey.PrivateExponent);
|
||||
keys.Set(rsaParams);
|
||||
|
@ -261,8 +261,8 @@ public class KeySet
|
|||
{
|
||||
return new RSAParameters
|
||||
{
|
||||
Exponent = key.PublicExponent.ItemsRo.ToArray(),
|
||||
Modulus = key.Modulus.ItemsRo.ToArray()
|
||||
Exponent = key.PublicExponent[..].ToArray(),
|
||||
Modulus = key.Modulus[..].ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -270,14 +270,14 @@ public class KeySet
|
|||
{
|
||||
return new RSAParameters
|
||||
{
|
||||
D = key.PrivateExponent.ItemsRo.ToArray(),
|
||||
DP = key.Dp.ItemsRo.ToArray(),
|
||||
DQ = key.Dq.ItemsRo.ToArray(),
|
||||
Exponent = key.PublicExponent.ItemsRo.ToArray(),
|
||||
InverseQ = key.InverseQ.ItemsRo.ToArray(),
|
||||
Modulus = key.Modulus.ItemsRo.ToArray(),
|
||||
P = key.P.ItemsRo.ToArray(),
|
||||
Q = key.Q.ItemsRo.ToArray()
|
||||
D = key.PrivateExponent[..].ToArray(),
|
||||
DP = key.Dp[..].ToArray(),
|
||||
DQ = key.Dq[..].ToArray(),
|
||||
Exponent = key.PublicExponent[..].ToArray(),
|
||||
InverseQ = key.InverseQ[..].ToArray(),
|
||||
Modulus = key.Modulus[..].ToArray(),
|
||||
P = key.P[..].ToArray(),
|
||||
Q = key.Q[..].ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -123,8 +123,8 @@ public struct HashSalt
|
|||
{
|
||||
private Array32<byte> _value;
|
||||
|
||||
[UnscopedRef] public Span<byte> Hash => _value.Items;
|
||||
[UnscopedRef] public readonly ReadOnlySpan<byte> HashRo => _value.ItemsRo;
|
||||
[UnscopedRef] public Span<byte> Hash => _value;
|
||||
[UnscopedRef] public readonly ReadOnlySpan<byte> HashRo => _value;
|
||||
}
|
||||
|
||||
public struct SaveDataAttribute : IEquatable<SaveDataAttribute>, IComparable<SaveDataAttribute>
|
||||
|
@ -385,19 +385,19 @@ internal static class SaveDataTypesValidity
|
|||
|
||||
public static bool IsValid(in SaveDataCreationInfo2 creationInfo)
|
||||
{
|
||||
foreach (byte b in creationInfo.Reserved1.ItemsRo)
|
||||
foreach (byte b in creationInfo.Reserved1)
|
||||
if (b != 0) return false;
|
||||
|
||||
foreach (byte b in creationInfo.Reserved2.ItemsRo)
|
||||
foreach (byte b in creationInfo.Reserved2)
|
||||
if (b != 0) return false;
|
||||
|
||||
foreach (byte b in creationInfo.Reserved3.ItemsRo)
|
||||
foreach (byte b in creationInfo.Reserved3)
|
||||
if (b != 0) return false;
|
||||
|
||||
foreach (byte b in creationInfo.Reserved4.ItemsRo)
|
||||
foreach (byte b in creationInfo.Reserved4)
|
||||
if (b != 0) return false;
|
||||
|
||||
foreach (byte b in creationInfo.Attribute.Reserved.ItemsRo)
|
||||
foreach (byte b in creationInfo.Attribute.Reserved)
|
||||
if (b != 0) return false;
|
||||
|
||||
return IsValid(in creationInfo.Attribute)
|
||||
|
|
|
@ -7,5 +7,5 @@ public struct EncryptionSeed
|
|||
{
|
||||
public Array16<byte> Value;
|
||||
|
||||
public readonly override string ToString() => Value.ItemsRo.ToHexString();
|
||||
public readonly override string ToString() => Value[..].ToHexString();
|
||||
}
|
|
@ -8,7 +8,7 @@ namespace LibHac.Fs;
|
|||
internal struct MountName
|
||||
{
|
||||
private Array16<byte> _nameArray;
|
||||
[UnscopedRef] public Span<byte> Name => _nameArray.Items;
|
||||
[UnscopedRef] public Span<byte> Name => _nameArray;
|
||||
|
||||
public override string ToString() => new U8Span(Name).ToString();
|
||||
}
|
|
@ -20,19 +20,19 @@ public struct RightsId : IEquatable<RightsId>
|
|||
|
||||
Unsafe.SkipInit(out Value);
|
||||
|
||||
Span<ulong> longsThis = MemoryMarshal.Cast<byte, ulong>(Value.Items);
|
||||
Span<ulong> longsThis = MemoryMarshal.Cast<byte, ulong>(Value);
|
||||
ReadOnlySpan<ulong> longsValue = MemoryMarshal.Cast<byte, ulong>(value);
|
||||
|
||||
longsThis[1] = longsValue[1];
|
||||
longsThis[0] = longsValue[0];
|
||||
}
|
||||
|
||||
public readonly override string ToString() => Value.ItemsRo.ToHexString();
|
||||
public readonly override string ToString() => Value[..].ToHexString();
|
||||
|
||||
public readonly string DebugDisplay()
|
||||
{
|
||||
ReadOnlySpan<byte> highBytes = Value.ItemsRo.Slice(0, 8);
|
||||
ReadOnlySpan<byte> lowBytes = Value.ItemsRo.Slice(8, 8);
|
||||
ReadOnlySpan<byte> highBytes = Value[..].Slice(0, 8);
|
||||
ReadOnlySpan<byte> lowBytes = Value[..].Slice(8, 8);
|
||||
|
||||
return $"{highBytes.ToHexString()} {lowBytes.ToHexString()}";
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public struct RightsId : IEquatable<RightsId>
|
|||
|
||||
public readonly override int GetHashCode()
|
||||
{
|
||||
ReadOnlySpan<ulong> longSpan = MemoryMarshal.Cast<byte, ulong>(Value.ItemsRo);
|
||||
ReadOnlySpan<ulong> longSpan = MemoryMarshal.Cast<byte, ulong>(Value[..]);
|
||||
return HashCode.Combine(longSpan[0], longSpan[1]);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public static class Host
|
|||
|
||||
public HostCommonMountNameGenerator(U8Span path)
|
||||
{
|
||||
StringUtils.Strlcpy(_path.Items, path, PathTool.EntryNameLengthMax + 1);
|
||||
StringUtils.Strlcpy(_path, path, PathTool.EntryNameLengthMax + 1);
|
||||
}
|
||||
|
||||
public void Dispose() { }
|
||||
|
|
|
@ -98,7 +98,7 @@ public class DebugConfigurationServiceImpl : IDisposable
|
|||
|
||||
using ScopedLock<SdkMutexType> scopedLock = ScopedLock.Lock(ref _mutex);
|
||||
|
||||
for (int i = 0; i < _entries.ItemsRo.Length; i++)
|
||||
for (int i = 0; i < _entries.Length; i++)
|
||||
{
|
||||
// Update the existing value if the key is already registered
|
||||
if (_entries[i].Key == key)
|
||||
|
@ -108,7 +108,7 @@ public class DebugConfigurationServiceImpl : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _entries.ItemsRo.Length; i++)
|
||||
for (int i = 0; i < _entries.Length; i++)
|
||||
{
|
||||
if (_entries[i].Key == 0)
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ public class DebugConfigurationServiceImpl : IDisposable
|
|||
|
||||
using ScopedLock<SdkMutexType> scopedLock = ScopedLock.Lock(ref _mutex);
|
||||
|
||||
for (int i = 0; i < _entries.ItemsRo.Length; i++)
|
||||
for (int i = 0; i < _entries.Length; i++)
|
||||
{
|
||||
if (_entries[i].Key == key)
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ public class DebugConfigurationServiceImpl : IDisposable
|
|||
|
||||
using ScopedLock<SdkMutexType> scopedLock = ScopedLock.Lock(ref _mutex);
|
||||
|
||||
for (int i = 0; i < _entries.ItemsRo.Length; i++)
|
||||
for (int i = 0; i < _entries.Length; i++)
|
||||
{
|
||||
if (_entries[i].Key == (uint)key)
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@ public class FileSystemProxyCoreImpl
|
|||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using scoped var path = new Path();
|
||||
res = PathFunctions.SetUpFixedPathSingleEntry(ref path.Ref(), pathBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathSingleEntry(ref path.Ref(), pathBuffer,
|
||||
CustomStorage.GetCustomStorageDirectoryName(CustomStorageId.System));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class FileSystemProxyCoreImpl
|
|||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using scoped var path = new Path();
|
||||
res = PathFunctions.SetUpFixedPathDoubleEntry(ref path.Ref(), pathBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathDoubleEntry(ref path.Ref(), pathBuffer,
|
||||
CommonDirNames.SdCardNintendoRootDirectoryName,
|
||||
CustomStorage.GetCustomStorageDirectoryName(CustomStorageId.System));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
|
|
@ -47,7 +47,7 @@ public class SaveDataFileSystemCreator : ISaveDataFileSystemCreator
|
|||
Unsafe.SkipInit(out Array18<byte> saveImageNameBuffer);
|
||||
|
||||
using scoped var saveImageName = new Path();
|
||||
Result res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
Result res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = baseFileSystem.Get.GetEntryType(out DirectoryEntryType type, in saveImageName);
|
||||
|
|
|
@ -58,7 +58,7 @@ internal class LocationResolverSet : IDisposable
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
for (int i = 0; i < Array5<SharedRef<LocationResolver>>.Length; i++)
|
||||
for (int i = 0; i < _resolvers.Length; i++)
|
||||
{
|
||||
if (_resolvers[i].HasValue)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Buffers.Text;
|
||||
using System.Runtime.CompilerServices;
|
||||
using LibHac.Common;
|
||||
using LibHac.Common.FixedArrays;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Fs.Fsa;
|
||||
using LibHac.FsSrv.FsCreator;
|
||||
|
@ -241,22 +240,23 @@ public class NcaFileSystemServiceImpl
|
|||
return ResultFs.InvalidArgument.Log();
|
||||
}
|
||||
|
||||
Unsafe.SkipInit(out Array64<byte> contentStoragePathBuffer);
|
||||
Span<byte> contentStoragePathBuffer = stackalloc byte[64];
|
||||
//Unsafe.SkipInit(out Array64<byte> contentStoragePathBuffer);
|
||||
|
||||
// Build the appropriate path for the content storage ID
|
||||
if (contentStorageId == ContentStorageId.SdCard)
|
||||
{
|
||||
var sb = new U8StringBuilder(contentStoragePathBuffer.Items);
|
||||
var sb = new U8StringBuilder(contentStoragePathBuffer);
|
||||
sb.Append(StringTraits.DirectorySeparator).Append(CommonDirNames.SdCardNintendoRootDirectoryName);
|
||||
sb.Append(StringTraits.DirectorySeparator).Append(CommonDirNames.ContentStorageDirectoryName);
|
||||
}
|
||||
else
|
||||
{
|
||||
var sb = new U8StringBuilder(contentStoragePathBuffer.Items);
|
||||
var sb = new U8StringBuilder(contentStoragePathBuffer);
|
||||
sb.Append(StringTraits.DirectorySeparator).Append(CommonDirNames.ContentStorageDirectoryName);
|
||||
}
|
||||
|
||||
using var contentStoragePath = new Path();
|
||||
using scoped var contentStoragePath = new Path();
|
||||
res = PathFunctions.SetUpFixedPath(ref contentStoragePath.Ref(), contentStoragePathBuffer);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
Unsafe.SkipInit(out Array18<byte> saveImageNameBuffer);
|
||||
|
||||
using scoped var saveImageName = new Path();
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = fileSystem.Get.GetEntryType(out _, in saveImageName);
|
||||
|
@ -170,7 +170,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
// Create the save data directory on the host if needed.
|
||||
Unsafe.SkipInit(out Array18<byte> saveDirectoryNameBuffer);
|
||||
using scoped var saveDirectoryName = new Path();
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveDirectoryName.Ref(), saveDirectoryNameBuffer.Items, saveDataId);
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveDirectoryName.Ref(), saveDirectoryNameBuffer, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = FsSystem.Utility.EnsureDirectory(fileSystem.Get, in saveDirectoryName);
|
||||
|
@ -234,7 +234,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
|
||||
using scoped var saveDataMetaIdDirectoryName = new Path();
|
||||
Result res = PathFunctions.SetUpFixedPathSaveMetaDir(ref saveDataMetaIdDirectoryName.Ref(),
|
||||
saveDataMetaIdDirectoryNameBuffer.Items, saveDataId);
|
||||
saveDataMetaIdDirectoryNameBuffer, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return OpenSaveDataDirectoryFileSystemImpl(ref outFileSystem, spaceId, in saveDataMetaIdDirectoryName).Ret();
|
||||
|
@ -314,7 +314,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
Unsafe.SkipInit(out Array15<byte> saveDataMetaNameBuffer);
|
||||
|
||||
using scoped var saveDataMetaName = new Path();
|
||||
res = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer,
|
||||
(uint)metaType);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -334,7 +334,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
Unsafe.SkipInit(out Array15<byte> saveDataMetaNameBuffer);
|
||||
|
||||
using scoped var saveDataMetaName = new Path();
|
||||
res = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer,
|
||||
(uint)metaType);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -361,7 +361,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using scoped var saveDataIdDirectoryName = new Path();
|
||||
PathFunctions.SetUpFixedPathSaveId(ref saveDataIdDirectoryName.Ref(), saveDataIdDirectoryNameBuffer.Items,
|
||||
PathFunctions.SetUpFixedPathSaveId(ref saveDataIdDirectoryName.Ref(), saveDataIdDirectoryNameBuffer,
|
||||
saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -390,7 +390,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
Unsafe.SkipInit(out Array15<byte> saveDataMetaNameBuffer);
|
||||
|
||||
using scoped var saveDataMetaName = new Path();
|
||||
res = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer,
|
||||
(uint)metaType);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -418,7 +418,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using scoped var saveImageName = new Path();
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
bool isPseudoSaveFs = _config.IsPseudoSaveData();
|
||||
|
@ -490,7 +490,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using scoped var saveImageName = new Path();
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Check if the save data is a file or a directory
|
||||
|
@ -758,7 +758,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
Unsafe.SkipInit(out Array64<byte> pathParentBuffer);
|
||||
|
||||
using scoped var pathParent = new Path();
|
||||
res = PathFunctions.SetUpFixedPathSingleEntry(ref pathParent.Ref(), pathParentBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathSingleEntry(ref pathParent.Ref(), pathParentBuffer,
|
||||
CommonDirNames.SdCardNintendoRootDirectoryName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
|
|
@ -77,8 +77,8 @@ public class SaveDataIndexer : ISaveDataIndexer
|
|||
{
|
||||
Assert.SdkRequires(!_isMounted);
|
||||
|
||||
int mountNameLength = StringUtils.Strlcpy(_mountName.Items, mountName, Array16<byte>.Length);
|
||||
Assert.SdkLess(mountNameLength, Array16<byte>.Length);
|
||||
int mountNameLength = StringUtils.Strlcpy(_mountName, mountName, _mountName.Length);
|
||||
Assert.SdkLess(mountNameLength, _mountName.Length);
|
||||
|
||||
_fsClient.DisableAutoSaveDataCreation();
|
||||
|
||||
|
@ -227,7 +227,7 @@ public class SaveDataIndexer : ISaveDataIndexer
|
|||
_handle = 1;
|
||||
_openReaders = new LinkedList<ReaderAccessor>();
|
||||
_isDelayedReaderUnregistrationRequired = false;
|
||||
StringUtils.Copy(_mountName.Items, mountName);
|
||||
StringUtils.Copy(_mountName, mountName);
|
||||
|
||||
_fsClient = fsClient;
|
||||
}
|
||||
|
|
|
@ -337,7 +337,7 @@ public class SaveDataFileStorageHolder
|
|||
Unsafe.SkipInit(out Array18<byte> saveImageNameBuffer);
|
||||
|
||||
using scoped var saveImageName = new Path();
|
||||
Result res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
Result res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// If an open type isn't specified, open the save without the shared file storage layer
|
||||
|
|
|
@ -11,10 +11,10 @@ public class SaveDataTransferCryptoConfiguration
|
|||
private Array256<byte> _kekEncryptionKeyModulus;
|
||||
private Array256<byte> _keyPackageSigningModulus;
|
||||
|
||||
public Span<byte> TokenSigningKeyModulus => _tokenSigningKeyModulus.Items;
|
||||
public Span<byte> KeySeedPackageSigningKeyModulus => _keySeedPackageSigningKeyModulus.Items;
|
||||
public Span<byte> KekEncryptionKeyModulus => _kekEncryptionKeyModulus.Items;
|
||||
public Span<byte> KeyPackageSigningModulus => _keyPackageSigningModulus.Items;
|
||||
public Span<byte> TokenSigningKeyModulus => _tokenSigningKeyModulus;
|
||||
public Span<byte> KeySeedPackageSigningKeyModulus => _keySeedPackageSigningKeyModulus;
|
||||
public Span<byte> KekEncryptionKeyModulus => _kekEncryptionKeyModulus;
|
||||
public Span<byte> KeyPackageSigningModulus => _keyPackageSigningModulus;
|
||||
|
||||
public SaveTransferAesKeyGenerator GenerateAesKey { get; set; }
|
||||
public RandomDataGenerator GenerateRandomData { get; set; }
|
||||
|
|
|
@ -44,12 +44,12 @@ public class AesCtrCounterExtendedStorage : IStorage
|
|||
|
||||
public void SetOffset(long value)
|
||||
{
|
||||
BinaryPrimitives.WriteInt64LittleEndian(Offset.Items, value);
|
||||
BinaryPrimitives.WriteInt64LittleEndian(Offset, value);
|
||||
}
|
||||
|
||||
public readonly long GetOffset()
|
||||
{
|
||||
return BinaryPrimitives.ReadInt64LittleEndian(Offset.ItemsRo);
|
||||
return BinaryPrimitives.ReadInt64LittleEndian(Offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ public class AesCtrCounterExtendedStorage : IStorage
|
|||
return ResultFs.InvalidAesCtrCounterExtendedDataStorageSize.Log();
|
||||
|
||||
_dataStorage.Set(in dataStorage);
|
||||
key.CopyTo(_key.Items);
|
||||
key.CopyTo(_key);
|
||||
_secureValue = secureValue;
|
||||
_counterOffset = counterOffset;
|
||||
_decryptor.Set(ref decryptor);
|
||||
|
@ -306,7 +306,7 @@ public class AesCtrCounterExtendedStorage : IStorage
|
|||
};
|
||||
|
||||
Unsafe.SkipInit(out Array16<byte> counter);
|
||||
AesCtrStorage.MakeIv(counter.Items, upperIv.Value, counterOffset);
|
||||
AesCtrStorage.MakeIv(counter, upperIv.Value, counterOffset);
|
||||
|
||||
// Decrypt the data from the current entry.
|
||||
res = _decryptor.Get.Decrypt(currentData.Slice(0, (int)dataSize), _key, counter);
|
||||
|
@ -440,7 +440,7 @@ public class AesCtrCounterExtendedStorage : IStorage
|
|||
Assert.SdkRequiresEqual(iv.Length, IvSize);
|
||||
|
||||
Unsafe.SkipInit(out Array16<byte> counter);
|
||||
iv.CopyTo(counter.Items);
|
||||
iv.CopyTo(counter);
|
||||
|
||||
int remainingSize = destination.Length;
|
||||
int currentOffset = 0;
|
||||
|
@ -466,7 +466,7 @@ public class AesCtrCounterExtendedStorage : IStorage
|
|||
|
||||
if (remainingSize > 0)
|
||||
{
|
||||
Utility.AddCounter(counter.Items, (uint)currentSize / (uint)BlockSize);
|
||||
Utility.AddCounter(counter, (uint)currentSize / (uint)BlockSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ public class AesCtrStorage : IStorage
|
|||
|
||||
_baseStorage = baseStorage;
|
||||
|
||||
key.CopyTo(_key.Items);
|
||||
iv.CopyTo(_iv.Items);
|
||||
key.CopyTo(_key);
|
||||
iv.CopyTo(_iv);
|
||||
}
|
||||
|
||||
public AesCtrStorage(in SharedRef<IStorage> baseStorage, ReadOnlySpan<byte> key, ReadOnlySpan<byte> iv)
|
||||
|
@ -59,8 +59,8 @@ public class AesCtrStorage : IStorage
|
|||
_baseStorage = baseStorage.Get;
|
||||
_baseStorageShared = SharedRef<IStorage>.CreateCopy(in baseStorage);
|
||||
|
||||
key.CopyTo(_key.Items);
|
||||
iv.CopyTo(_iv.Items);
|
||||
key.CopyTo(_key);
|
||||
iv.CopyTo(_iv);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
|
@ -88,7 +88,7 @@ public class AesCtrStorage : IStorage
|
|||
using var changePriority = new ScopedThreadPriorityChanger(1, ScopedThreadPriorityChanger.Mode.Relative);
|
||||
|
||||
Array16<byte> counter = _iv;
|
||||
Utility.AddCounter(counter.Items, (ulong)offset / (uint)BlockSize);
|
||||
Utility.AddCounter(counter, (ulong)offset / (uint)BlockSize);
|
||||
|
||||
int decSize = Aes.DecryptCtr128(destination, destination, _key, counter);
|
||||
if (decSize != destination.Length)
|
||||
|
@ -121,7 +121,7 @@ public class AesCtrStorage : IStorage
|
|||
|
||||
// Setup the counter.
|
||||
var counter = new Array16<byte>();
|
||||
Utility.AddCounter(counter.Items, (ulong)offset / (uint)BlockSize);
|
||||
Utility.AddCounter(counter, (ulong)offset / (uint)BlockSize);
|
||||
|
||||
// Loop until all data is written.
|
||||
int remaining = source.Length;
|
||||
|
@ -152,7 +152,7 @@ public class AesCtrStorage : IStorage
|
|||
remaining -= writeSize;
|
||||
if (remaining > 0)
|
||||
{
|
||||
Utility.AddCounter(counter.Items, (uint)writeSize / (uint)BlockSize);
|
||||
Utility.AddCounter(counter, (uint)writeSize / (uint)BlockSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ public class AesXtsStorage : IStorage
|
|||
Assert.SdkRequiresEqual(IvSize, iv.Length);
|
||||
Assert.SdkRequiresAligned(blockSize, AesBlockSize);
|
||||
|
||||
key1.CopyTo(_key1.Items);
|
||||
key2.CopyTo(_key2.Items);
|
||||
iv.CopyTo(_iv.Items);
|
||||
key1.CopyTo(_key1);
|
||||
key2.CopyTo(_key2);
|
||||
iv.CopyTo(_iv);
|
||||
}
|
||||
|
||||
public AesXtsStorage(ref SharedRef<IStorage> baseStorage, ReadOnlySpan<byte> key1, ReadOnlySpan<byte> key2,
|
||||
|
@ -70,9 +70,9 @@ public class AesXtsStorage : IStorage
|
|||
Assert.SdkRequiresEqual(IvSize, iv.Length);
|
||||
Assert.SdkRequiresAligned(blockSize, AesBlockSize);
|
||||
|
||||
key1.CopyTo(_key1.Items);
|
||||
key2.CopyTo(_key2.Items);
|
||||
iv.CopyTo(_iv.Items);
|
||||
key1.CopyTo(_key1);
|
||||
key2.CopyTo(_key2);
|
||||
iv.CopyTo(_iv);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
|
|
|
@ -45,12 +45,12 @@ public class AesXtsStorageExternal : IStorage
|
|||
Assert.SdkRequiresAligned(blockSize, AesBlockSize);
|
||||
|
||||
if (key1.Length != 0)
|
||||
key1.CopyTo(_key[0].Items);
|
||||
key1.CopyTo(_key[0]);
|
||||
|
||||
if (key2.Length != 0)
|
||||
key2.CopyTo(_key[1].Items);
|
||||
key2.CopyTo(_key[1]);
|
||||
|
||||
iv.CopyTo(_iv.Items);
|
||||
iv.CopyTo(_iv);
|
||||
}
|
||||
|
||||
public AesXtsStorageExternal(in SharedRef<IStorage> baseStorage, ReadOnlySpan<byte> key1, ReadOnlySpan<byte> key2,
|
||||
|
@ -93,7 +93,7 @@ public class AesXtsStorageExternal : IStorage
|
|||
|
||||
// Setup the counter.
|
||||
Span<byte> counter = stackalloc byte[IvSize];
|
||||
_iv.ItemsRo.CopyTo(counter);
|
||||
_iv[..].CopyTo(counter);
|
||||
Utility.AddCounter(counter, (ulong)offset / _blockSize);
|
||||
|
||||
// Handle any unaligned data before the start.
|
||||
|
@ -175,7 +175,7 @@ public class AesXtsStorageExternal : IStorage
|
|||
|
||||
// Setup the counter.
|
||||
Span<byte> counter = stackalloc byte[IvSize];
|
||||
_iv.ItemsRo.CopyTo(counter);
|
||||
_iv[..].CopyTo(counter);
|
||||
Utility.AddCounter(counter, (ulong)offset / _blockSize);
|
||||
|
||||
// Handle any unaligned data before the start.
|
||||
|
|
|
@ -535,9 +535,9 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
private static Result AppendInternalFilePath(ref Path path, int index)
|
||||
{
|
||||
var buffer = new Array3<byte>();
|
||||
Utf8Formatter.TryFormat(index, buffer.Items, out _, new StandardFormat('d', 2));
|
||||
Utf8Formatter.TryFormat(index, buffer, out _, new StandardFormat('d', 2));
|
||||
|
||||
return path.AppendChild(buffer.ItemsRo).Ret();
|
||||
return path.AppendChild(buffer).Ret();
|
||||
}
|
||||
|
||||
private static Result GenerateInternalFilePath(ref Path outPath, int index, in Path basePath)
|
||||
|
|
|
@ -37,7 +37,7 @@ public struct PartitionFileSystemFormat : IPartitionFileSystemFormat
|
|||
{
|
||||
get
|
||||
{
|
||||
ReadOnlySpan<byte> span = _signature.ItemsRo;
|
||||
ReadOnlySpan<byte> span = _signature;
|
||||
return MemoryMarshal.CreateReadOnlySpan(ref MemoryMarshal.GetReference(span), span.Length);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class IndirectStorage : IStorage
|
|||
{
|
||||
FinalizeObject();
|
||||
|
||||
Span<ValueSubStorage> items = _dataStorage.Items;
|
||||
Span<ValueSubStorage> items = _dataStorage;
|
||||
for (int i = 0; i < items.Length; i++)
|
||||
items[i].Dispose();
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class IndirectStorage : IStorage
|
|||
{
|
||||
_table.FinalizeObject();
|
||||
|
||||
Span<ValueSubStorage> storages = _dataStorage.Items;
|
||||
Span<ValueSubStorage> storages = _dataStorage;
|
||||
for (int i = 0; i < storages.Length; i++)
|
||||
{
|
||||
using var emptySubStorage = new ValueSubStorage();
|
||||
|
@ -303,9 +303,9 @@ public class IndirectStorage : IStorage
|
|||
Result res = _table.InvalidateCache();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
for (int i = 0; i < _dataStorage.Items.Length; i++)
|
||||
for (int i = 0; i < _dataStorage.Length; i++)
|
||||
{
|
||||
res = _dataStorage.Items[i].OperateRange(OperationId.InvalidateCache, 0, long.MaxValue);
|
||||
res = _dataStorage[i].OperateRange(OperationId.InvalidateCache, 0, long.MaxValue);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class IntegrityVerificationStorage : IStorage
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static void SetValidationBit(ref BlockHash hash)
|
||||
{
|
||||
hash.Hash.Items[HashSize - 1] |= 0x80;
|
||||
hash.Hash[HashSize - 1] |= 0x80;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -82,7 +82,7 @@ public class IntegrityVerificationStorage : IStorage
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static bool IsValidationBit(in BlockHash hash)
|
||||
{
|
||||
return (hash.Hash.ItemsRo[HashSize - 1] & 0x80) != 0;
|
||||
return (hash.Hash[HashSize - 1] & 0x80) != 0;
|
||||
}
|
||||
|
||||
public int GetBlockSize()
|
||||
|
@ -611,9 +611,9 @@ public class IntegrityVerificationStorage : IStorage
|
|||
if (IsValidationBit(in hash))
|
||||
return Result.Success;
|
||||
|
||||
for (int i = 0; i < hash.Hash.ItemsRo.Length; i++)
|
||||
for (int i = 0; i < hash.Hash.Length; i++)
|
||||
{
|
||||
if (hash.Hash.ItemsRo[i] != 0)
|
||||
if (hash.Hash[i] != 0)
|
||||
return ResultFs.InvalidZeroHash.Log();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class LocalDirectory : IDirectory
|
|||
DirectoryEntryType type = isDir ? DirectoryEntryType.Directory : DirectoryEntryType.File;
|
||||
long length = isDir ? 0 : ((FileInfo)localEntry).Length;
|
||||
|
||||
StringUtils.Copy(entryBuffer[i].Name.Items, name);
|
||||
StringUtils.Copy(entryBuffer[i].Name, name);
|
||||
entryBuffer[i].Name[PathTool.EntryNameLengthMax] = 0;
|
||||
|
||||
entryBuffer[i].Attributes = localEntry.Attributes.ToNxAttributes();
|
||||
|
|
|
@ -64,7 +64,7 @@ public class NcaReader : IDisposable
|
|||
Unsafe.SkipInit(out Array2<Array16<byte>> commonDecryptionKeys);
|
||||
for (int i = 0; i < NcaCryptoConfiguration.HeaderEncryptionKeyCount; i++)
|
||||
{
|
||||
cryptoConfig.GenerateKey(commonDecryptionKeys[i].Items, cryptoConfig.HeaderEncryptedEncryptionKeys[i],
|
||||
cryptoConfig.GenerateKey(commonDecryptionKeys[i], cryptoConfig.HeaderEncryptedEncryptionKeys[i],
|
||||
headerKeyTypes[i]);
|
||||
}
|
||||
|
||||
|
@ -158,18 +158,18 @@ public class NcaReader : IDisposable
|
|||
if (cryptoConfig.IsAvailableSwKey)
|
||||
{
|
||||
int keyTypeValue = NcaKeyFunctions.GetKeyTypeValue(_header.KeyAreaEncryptionKeyIndex, _header.GetProperKeyGeneration());
|
||||
ReadOnlySpan<byte> encryptedKeyCtr = _header.EncryptedKeys.ItemsRo.Slice((int)NcaHeader.DecryptionKey.AesCtr * Aes.KeySize128, Aes.KeySize128);
|
||||
ReadOnlySpan<byte> encryptedKeyCtr = _header.EncryptedKeys[..].Slice((int)NcaHeader.DecryptionKey.AesCtr * Aes.KeySize128, Aes.KeySize128);
|
||||
|
||||
cryptoConfig.GenerateKey(_decryptionKeys[(int)NcaHeader.DecryptionKey.AesCtr].Items, encryptedKeyCtr, keyTypeValue);
|
||||
cryptoConfig.GenerateKey(_decryptionKeys[(int)NcaHeader.DecryptionKey.AesCtr], encryptedKeyCtr, keyTypeValue);
|
||||
}
|
||||
|
||||
// Copy the plaintext hardware key.
|
||||
ReadOnlySpan<byte> keyCtrHw = _header.EncryptedKeys.ItemsRo.Slice((int)NcaHeader.DecryptionKey.AesCtrHw * Aes.KeySize128, Aes.KeySize128);
|
||||
keyCtrHw.CopyTo(_decryptionKeys[(int)NcaHeader.DecryptionKey.AesCtrHw].Items);
|
||||
ReadOnlySpan<byte> keyCtrHw = _header.EncryptedKeys[..].Slice((int)NcaHeader.DecryptionKey.AesCtrHw * Aes.KeySize128, Aes.KeySize128);
|
||||
keyCtrHw.CopyTo(_decryptionKeys[(int)NcaHeader.DecryptionKey.AesCtrHw]);
|
||||
}
|
||||
|
||||
// Clear the external decryption key.
|
||||
_externalDataDecryptionKey.Items.Clear();
|
||||
_externalDataDecryptionKey[..].Clear();
|
||||
|
||||
// Copy the configuration to the NcaReader.
|
||||
_isAvailableSwKey = cryptoConfig.IsAvailableSwKey;
|
||||
|
@ -212,7 +212,7 @@ public class NcaReader : IDisposable
|
|||
{
|
||||
Assert.SdkRequiresEqual(NcaHeader.HeaderSignSize, outBuffer.Length);
|
||||
|
||||
_header.Signature2.ItemsRo.CopyTo(outBuffer);
|
||||
_header.Signature2[..].CopyTo(outBuffer);
|
||||
}
|
||||
|
||||
public void GetHeaderSign2TargetHash(Span<byte> outBuffer)
|
||||
|
@ -294,7 +294,7 @@ public class NcaReader : IDisposable
|
|||
{
|
||||
Assert.SdkRequiresGreaterEqual(outBuffer.Length, NcaHeader.RightsIdSize);
|
||||
|
||||
_header.RightsId.ItemsRo.CopyTo(outBuffer);
|
||||
_header.RightsId[..].CopyTo(outBuffer);
|
||||
}
|
||||
|
||||
public bool HasFsInfo(int index)
|
||||
|
@ -377,7 +377,7 @@ public class NcaReader : IDisposable
|
|||
Assert.SdkRequiresNotNull(_bodyStorage);
|
||||
Assert.SdkRequiresGreaterEqual(outBuffer.Length, NcaHeader.EncryptedKeyAreaSize);
|
||||
|
||||
_header.EncryptedKeys.ItemsRo.CopyTo(outBuffer);
|
||||
_header.EncryptedKeys[..].CopyTo(outBuffer);
|
||||
}
|
||||
|
||||
public ReadOnlySpan<byte> GetDecryptionKey(int index)
|
||||
|
@ -395,7 +395,7 @@ public class NcaReader : IDisposable
|
|||
for (int i = 0; i < (int)NcaHeader.DecryptionKey.Count; i++)
|
||||
{
|
||||
if (!CryptoUtil.IsSameBytes(zeroKey,
|
||||
_header.EncryptedKeys.ItemsRo.Slice(i * Aes.KeySize128, Aes.KeySize128), Aes.KeySize128))
|
||||
_header.EncryptedKeys[..].Slice(i * Aes.KeySize128, Aes.KeySize128), Aes.KeySize128))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ public class NcaReader : IDisposable
|
|||
{
|
||||
Array16<byte> zeroKey = default;
|
||||
return !CryptoUtil.IsSameBytes(zeroKey, GetDecryptionKey((int)NcaHeader.DecryptionKey.AesCtrHw),
|
||||
Array16<byte>.Length);
|
||||
zeroKey.Length);
|
||||
}
|
||||
|
||||
public bool IsSwAesPrioritized()
|
||||
|
@ -428,20 +428,20 @@ public class NcaReader : IDisposable
|
|||
|
||||
public void SetExternalDecryptionKey(ReadOnlySpan<byte> key)
|
||||
{
|
||||
Assert.SdkRequiresEqual(_externalDataDecryptionKey.ItemsRo.Length, key.Length);
|
||||
Assert.SdkRequiresEqual(_externalDataDecryptionKey[..].Length, key.Length);
|
||||
|
||||
key.CopyTo(_externalDataDecryptionKey.Items);
|
||||
key.CopyTo(_externalDataDecryptionKey);
|
||||
}
|
||||
|
||||
public ReadOnlySpan<byte> GetExternalDecryptionKey()
|
||||
{
|
||||
return _externalDataDecryptionKey.ItemsRo;
|
||||
return _externalDataDecryptionKey;
|
||||
}
|
||||
|
||||
public bool HasExternalDecryptionKey()
|
||||
{
|
||||
Array16<byte> zeroKey = default;
|
||||
return !CryptoUtil.IsSameBytes(zeroKey, GetExternalDecryptionKey(), Array16<byte>.Length);
|
||||
return !CryptoUtil.IsSameBytes(zeroKey, GetExternalDecryptionKey(), zeroKey.Length);
|
||||
}
|
||||
|
||||
public void GetRawData(Span<byte> outBuffer)
|
||||
|
@ -505,7 +505,7 @@ public class NcaFsHeaderReader
|
|||
|
||||
Unsafe.SkipInit(out Hash hash);
|
||||
IHash256GeneratorFactory generator = reader.GetHashGeneratorFactorySelector().GetFactory(HashAlgorithmType.Sha2);
|
||||
generator.GenerateHash(hash.Value.Items, SpanHelpers.AsReadOnlyByteSpan(in _header));
|
||||
generator.GenerateHash(hash.Value, SpanHelpers.AsReadOnlyByteSpan(in _header));
|
||||
|
||||
if (!CryptoUtil.IsSameBytes(reader.GetFsHeaderHash(index).Value, hash.Value, Unsafe.SizeOf<Hash>()))
|
||||
{
|
||||
|
|
|
@ -370,7 +370,7 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||
dirEntry.Type = DirectoryEntryType.File;
|
||||
dirEntry.Size = entry.Size;
|
||||
U8Span entryName = _parent._metaData.GetEntryName(_currentIndex);
|
||||
StringUtils.Strlcpy(dirEntry.Name.Items, entryName, dirEntry.Name.ItemsRo.Length - 1);
|
||||
StringUtils.Strlcpy(dirEntry.Name, entryName, dirEntry.Name[..].Length - 1);
|
||||
|
||||
_currentIndex++;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public sealed class GameCardEmulated : IGcApi
|
|||
Abort.DoAbortUnlessSuccess(ReadBaseStorage(0x100, SpanHelpers.AsByteSpan(ref _cardHeader)));
|
||||
Abort.DoAbortUnlessSuccess(ReadBaseStorage(GcCertAreaPageAddress * GcPageSize, SpanHelpers.AsByteSpan(ref _certificate)));
|
||||
|
||||
Sha256.GenerateSha256Hash(SpanHelpers.AsReadOnlyByteSpan(in _cardHeader), _imageHash.Items);
|
||||
Sha256.GenerateSha256Hash(SpanHelpers.AsReadOnlyByteSpan(in _cardHeader), _imageHash);
|
||||
|
||||
DecryptCardHeader(ref _cardHeader);
|
||||
|
||||
|
@ -361,7 +361,7 @@ public sealed class GameCardEmulated : IGcApi
|
|||
Result res = CheckCardReady();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_certificate.T1CardDeviceId.ItemsRo.CopyTo(destBuffer);
|
||||
_certificate.T1CardDeviceId[..].CopyTo(destBuffer);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -393,7 +393,7 @@ public sealed class GameCardEmulated : IGcApi
|
|||
Result res = CheckCardReady();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_imageHash.ItemsRo.CopyTo(destBuffer);
|
||||
_imageHash[..].CopyTo(destBuffer);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ internal class GameCardStorageDevice : GameCardStorageInterfaceAdapter, IStorage
|
|||
_handle = handle;
|
||||
_isSecure = isSecure;
|
||||
|
||||
cardDeviceId.CopyTo(_cardDeviceId.Items);
|
||||
cardImageHash.CopyTo(_cardImageHash.Items);
|
||||
cardDeviceId.CopyTo(_cardDeviceId);
|
||||
cardImageHash.CopyTo(_cardImageHash);
|
||||
|
||||
_gc = gc;
|
||||
}
|
||||
|
|
|
@ -92,9 +92,9 @@ public class NsoReader
|
|||
if (checkHash)
|
||||
{
|
||||
var hash = new Array32<byte>();
|
||||
Crypto.Sha256.GenerateSha256Hash(buffer.Slice(0, (int)segment.Size), hash.Items);
|
||||
Crypto.Sha256.GenerateSha256Hash(buffer.Slice(0, (int)segment.Size), hash);
|
||||
|
||||
if (hash.ItemsRo.SequenceCompareTo(fileHash) != 0)
|
||||
if (hash[..].SequenceCompareTo(fileHash) != 0)
|
||||
return ResultLoader.InvalidNso.Log();
|
||||
}
|
||||
|
||||
|
|
|
@ -71,18 +71,18 @@ public struct ApplicationControlProperty
|
|||
public AccessibleLaunchRequiredVersionValue AccessibleLaunchRequiredVersion;
|
||||
public Array3000<byte> Reserved3448;
|
||||
|
||||
[UnscopedRef] public readonly U8Span IsbnString => new U8Span(Isbn.ItemsRo);
|
||||
[UnscopedRef] public readonly U8Span DisplayVersionString => new U8Span(DisplayVersion.ItemsRo);
|
||||
[UnscopedRef] public readonly U8Span ApplicationErrorCodeCategoryString => new U8Span(ApplicationErrorCodeCategory.ItemsRo);
|
||||
[UnscopedRef] public readonly U8Span BcatPassphraseString => new U8Span(BcatPassphrase.ItemsRo);
|
||||
[UnscopedRef] public readonly U8Span IsbnString => new U8Span(Isbn);
|
||||
[UnscopedRef] public readonly U8Span DisplayVersionString => new U8Span(DisplayVersion);
|
||||
[UnscopedRef] public readonly U8Span ApplicationErrorCodeCategoryString => new U8Span(ApplicationErrorCodeCategory);
|
||||
[UnscopedRef] public readonly U8Span BcatPassphraseString => new U8Span(BcatPassphrase);
|
||||
|
||||
public struct ApplicationTitle
|
||||
{
|
||||
public Array512<byte> Name;
|
||||
public Array256<byte> Publisher;
|
||||
|
||||
[UnscopedRef] public readonly U8Span NameString => new U8Span(Name.ItemsRo);
|
||||
[UnscopedRef] public readonly U8Span PublisherString => new U8Span(Publisher.ItemsRo);
|
||||
[UnscopedRef] public readonly U8Span NameString => new U8Span(Name);
|
||||
[UnscopedRef] public readonly U8Span PublisherString => new U8Span(Publisher);
|
||||
}
|
||||
|
||||
public struct ApplicationNeighborDetectionClientConfiguration
|
||||
|
|
|
@ -158,7 +158,7 @@ public class Ticket
|
|||
return commonKey;
|
||||
}
|
||||
|
||||
if (keySet.ETicketRsaKey.PublicExponent.ItemsRo.IsZeros())
|
||||
if (keySet.ETicketRsaKey.PublicExponent[..].IsZeros())
|
||||
return null;
|
||||
|
||||
try
|
||||
|
|
|
@ -252,7 +252,7 @@ public class InMemoryFileSystem : IAttributeFileSystem
|
|||
{
|
||||
ref DirectoryEntry entry = ref entryBuffer[i];
|
||||
|
||||
StringUtils.Copy(entry.Name.Items, CurrentDir.Name);
|
||||
StringUtils.Copy(entry.Name, CurrentDir.Name);
|
||||
entry.Name[PathTool.EntryNameLengthMax] = 0;
|
||||
|
||||
entry.Type = DirectoryEntryType.Directory;
|
||||
|
@ -270,7 +270,7 @@ public class InMemoryFileSystem : IAttributeFileSystem
|
|||
{
|
||||
ref DirectoryEntry entry = ref entryBuffer[i];
|
||||
|
||||
StringUtils.Copy(entry.Name.Items, CurrentFile.Name);
|
||||
StringUtils.Copy(entry.Name, CurrentFile.Name);
|
||||
entry.Name[PathTool.EntryNameLengthMax] = 0;
|
||||
|
||||
entry.Type = DirectoryEntryType.File;
|
||||
|
|
|
@ -232,7 +232,7 @@ public class SwitchFs : IDisposable
|
|||
control.Get.Read(out _, 0, title.Control.ByteSpan).ThrowIfFailure();
|
||||
}
|
||||
|
||||
foreach (ref readonly ApplicationControlProperty.ApplicationTitle desc in title.Control.Value.Title.ItemsRo)
|
||||
foreach (ref readonly ApplicationControlProperty.ApplicationTitle desc in title.Control.Value.Title)
|
||||
{
|
||||
if (!desc.NameString.IsEmpty())
|
||||
{
|
||||
|
|
|
@ -220,14 +220,14 @@ public class XciHeader
|
|||
|
||||
ref readonly CardInitialData data = ref SpanHelpers.AsReadOnlyStruct<CardInitialData>(initialData);
|
||||
|
||||
if (dest.Length != data.Payload.AuthData.ItemsRo.Length)
|
||||
if (dest.Length != data.Payload.AuthData[..].Length)
|
||||
return ResultFs.GameCardPreconditionViolation.Log();
|
||||
|
||||
// Verify padding is all-zero.
|
||||
bool anyNonZero = false;
|
||||
for (int i = 0; i < data.Padding.ItemsRo.Length; i++)
|
||||
for (int i = 0; i < data.Padding.Length; i++)
|
||||
{
|
||||
anyNonZero |= data.Padding.ItemsRo[i] != 0;
|
||||
anyNonZero |= data.Padding[i] != 0;
|
||||
}
|
||||
|
||||
if (anyNonZero)
|
||||
|
|
|
@ -173,7 +173,7 @@ public class Nca
|
|||
ref NcaSparseInfo sparseInfo = ref fsHeader.GetSparseInfo();
|
||||
|
||||
Unsafe.SkipInit(out BucketTree.Header header);
|
||||
sparseInfo.MetaHeader.ItemsRo.CopyTo(SpanHelpers.AsByteSpan(ref header));
|
||||
sparseInfo.MetaHeader[..].CopyTo(SpanHelpers.AsByteSpan(ref header));
|
||||
header.Verify().ThrowIfFailure();
|
||||
|
||||
var sparseStorage = new SparseStorage();
|
||||
|
@ -429,7 +429,7 @@ public class Nca
|
|||
ref NcaCompressionInfo compressionInfo = ref header.GetCompressionInfo();
|
||||
|
||||
Unsafe.SkipInit(out BucketTree.Header bucketTreeHeader);
|
||||
compressionInfo.TableHeader.ItemsRo.CopyTo(SpanHelpers.AsByteSpan(ref bucketTreeHeader));
|
||||
compressionInfo.TableHeader[..].CopyTo(SpanHelpers.AsByteSpan(ref bucketTreeHeader));
|
||||
bucketTreeHeader.Verify().ThrowIfFailure();
|
||||
|
||||
long nodeStorageSize = CompressedStorage.QueryNodeStorageSize(bucketTreeHeader.EntryCount);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class RomFsDirectory : IDirectory
|
|||
ref DirectoryEntry entry = ref entryBuffer[i];
|
||||
Span<byte> nameUtf8 = Encoding.UTF8.GetBytes(name);
|
||||
|
||||
StringUtils.Copy(entry.Name.Items, nameUtf8);
|
||||
StringUtils.Copy(entry.Name, nameUtf8);
|
||||
entry.Name[PathTool.EntryNameLengthMax] = 0;
|
||||
|
||||
entry.Type = DirectoryEntryType.Directory;
|
||||
|
@ -70,7 +70,7 @@ public class RomFsDirectory : IDirectory
|
|||
ref DirectoryEntry entry = ref entryBuffer[i];
|
||||
Span<byte> nameUtf8 = Encoding.UTF8.GetBytes(name);
|
||||
|
||||
StringUtils.Copy(entry.Name.Items, nameUtf8);
|
||||
StringUtils.Copy(entry.Name, nameUtf8);
|
||||
entry.Name[PathTool.EntryNameLengthMax] = 0;
|
||||
|
||||
entry.Type = DirectoryEntryType.File;
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SaveDataDirectory : IDirectory
|
|||
ref DirectoryEntry entry = ref entryBuffer[i];
|
||||
Span<byte> nameUtf8 = Encoding.UTF8.GetBytes(name);
|
||||
|
||||
StringUtils.Copy(entry.Name.Items, nameUtf8);
|
||||
StringUtils.Copy(entry.Name, nameUtf8);
|
||||
entry.Name[64] = 0;
|
||||
|
||||
entry.Type = DirectoryEntryType.Directory;
|
||||
|
@ -70,7 +70,7 @@ public class SaveDataDirectory : IDirectory
|
|||
ref DirectoryEntry entry = ref entryBuffer[i];
|
||||
Span<byte> nameUtf8 = Encoding.UTF8.GetBytes(name);
|
||||
|
||||
StringUtils.Copy(entry.Name.Items, nameUtf8);
|
||||
StringUtils.Copy(entry.Name, nameUtf8);
|
||||
entry.Name[64] = 0;
|
||||
|
||||
entry.Type = DirectoryEntryType.File;
|
||||
|
|
|
@ -13,7 +13,6 @@ using LibHac.Tools.Fs;
|
|||
using LibHac.Tools.FsSystem;
|
||||
using LibHac.Tools.FsSystem.NcaUtils;
|
||||
using LibHac.Tools.Npdm;
|
||||
using LibHac.Util;
|
||||
using static hactoolnet.Print;
|
||||
using NcaFsHeader = LibHac.Tools.FsSystem.NcaUtils.NcaFsHeader;
|
||||
|
||||
|
|
|
@ -65,9 +65,9 @@ internal static class ProcessPackage
|
|||
if (package1.IsMariko)
|
||||
{
|
||||
sb.AppendLine("Mariko OEM Header:");
|
||||
PrintItem(sb, colLen, " Signature:", package1.MarikoOemHeader.RsaSig.ItemsRo.ToArray());
|
||||
PrintItem(sb, colLen, " Random Salt:", package1.MarikoOemHeader.Salt.ItemsRo.ToArray());
|
||||
PrintItem(sb, colLen, " OEM Bootloader Hash:", package1.MarikoOemHeader.Hash.ItemsRo.ToArray());
|
||||
PrintItem(sb, colLen, " Signature:", package1.MarikoOemHeader.RsaSig[..].ToArray());
|
||||
PrintItem(sb, colLen, " Random Salt:", package1.MarikoOemHeader.Salt[..].ToArray());
|
||||
PrintItem(sb, colLen, " OEM Bootloader Hash:", package1.MarikoOemHeader.Hash[..].ToArray());
|
||||
PrintItem(sb, colLen, " OEM Bootloader Version:", $"{package1.MarikoOemHeader.Version:x2}");
|
||||
PrintItem(sb, colLen, " OEM Bootloader Size:", $"{package1.MarikoOemHeader.Size:x8}");
|
||||
PrintItem(sb, colLen, " OEM Bootloader Load Address:", $"{package1.MarikoOemHeader.LoadAddress:x8}");
|
||||
|
@ -98,7 +98,7 @@ internal static class ProcessPackage
|
|||
validity = mac.SequenceEqual(package1.Pk11Mac) ? " (Valid)" : " (Invalid)";
|
||||
}
|
||||
|
||||
PrintItem(sb, colLen, $" PK11 MAC:{validity}", package1.Pk11Mac.ItemsRo.ToArray());
|
||||
PrintItem(sb, colLen, $" PK11 MAC:{validity}", package1.Pk11Mac[..].ToArray());
|
||||
}
|
||||
|
||||
if (package1.IsDecrypted)
|
||||
|
@ -178,7 +178,7 @@ internal static class ProcessPackage
|
|||
sb.AppendLine();
|
||||
|
||||
sb.AppendLine("PK21:");
|
||||
PrintItem(sb, colLen, $"Signature{signatureValidity.GetValidityString()}:", package2.Header.Signature.ItemsRo.ToArray());
|
||||
PrintItem(sb, colLen, $"Signature{signatureValidity.GetValidityString()}:", package2.Header.Signature[..].ToArray());
|
||||
PrintItem(sb, colLen, "Header Version:", $"{package2.Header.Meta.GetKeyGeneration():x2}");
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
|
@ -186,8 +186,8 @@ internal static class ProcessPackage
|
|||
string name = package2.Header.Meta.PayloadSizes[i] != 0 ? Package2SectionNames[i] : "Empty";
|
||||
sb.AppendLine($"Section {i} ({name}):");
|
||||
|
||||
PrintItem(sb, colLen, " Hash:", package2.Header.Meta.PayloadHashes[i].ItemsRo.ToArray());
|
||||
PrintItem(sb, colLen, " CTR:", package2.Header.Meta.PayloadIvs[i].ItemsRo.ToArray());
|
||||
PrintItem(sb, colLen, " Hash:", package2.Header.Meta.PayloadHashes[i][..].ToArray());
|
||||
PrintItem(sb, colLen, " CTR:", package2.Header.Meta.PayloadIvs[i][..].ToArray());
|
||||
PrintItem(sb, colLen, " Load Address:", $"{package2.Header.Meta.PayloadOffsets[i] + 0x80000000:x8}");
|
||||
PrintItem(sb, colLen, " Size:", $"{package2.Header.Meta.PayloadSizes[i]:x8}");
|
||||
}
|
||||
|
|
|
@ -6,35 +6,35 @@ namespace LibHac.Tests.Common;
|
|||
|
||||
public class FixedArraySizeTests
|
||||
{
|
||||
[Fact] public static void Array1SpanSizeIsCorrect() => Assert.Equal(1, new Array1<byte>().Items.Length);
|
||||
[Fact] public static void Array1SpanSizeIsCorrect() => Assert.Equal(1, new Array1<byte>().Length);
|
||||
[Fact] public static void Array1ByteSizeIsCorrect() => Assert.Equal(sizeof(byte) * 1, Unsafe.SizeOf<Array1<byte>>());
|
||||
[Fact] public static void Array1LongSizeIsCorrect() => Assert.Equal(sizeof(long) * 1, Unsafe.SizeOf<Array1<long>>());
|
||||
|
||||
[Fact] public static void Array3SpanSizeIsCorrect() => Assert.Equal(3, new Array3<byte>().Items.Length);
|
||||
[Fact] public static void Array3SpanSizeIsCorrect() => Assert.Equal(3, new Array3<byte>().Length);
|
||||
[Fact] public static void Array3ByteSizeIsCorrect() => Assert.Equal(sizeof(byte) * 3, Unsafe.SizeOf<Array3<byte>>());
|
||||
[Fact] public static void Array3LongSizeIsCorrect() => Assert.Equal(sizeof(long) * 3, Unsafe.SizeOf<Array3<long>>());
|
||||
|
||||
[Fact] public static void Array8SpanSizeIsCorrect() => Assert.Equal(8, new Array8<byte>().Items.Length);
|
||||
[Fact] public static void Array8SpanSizeIsCorrect() => Assert.Equal(8, new Array8<byte>().Length);
|
||||
[Fact] public static void Array8ByteSizeIsCorrect() => Assert.Equal(sizeof(byte) * 8, Unsafe.SizeOf<Array8<byte>>());
|
||||
[Fact] public static void Array8LongSizeIsCorrect() => Assert.Equal(sizeof(long) * 8, Unsafe.SizeOf<Array8<long>>());
|
||||
|
||||
[Fact] public static void Array12SpanSizeIsCorrect() => Assert.Equal(12, new Array12<byte>().Items.Length);
|
||||
[Fact] public static void Array12SpanSizeIsCorrect() => Assert.Equal(12, new Array12<byte>().Length);
|
||||
[Fact] public static void Array12ByteSizeIsCorrect() => Assert.Equal(sizeof(byte) * 12, Unsafe.SizeOf<Array12<byte>>());
|
||||
[Fact] public static void Array12LongSizeIsCorrect() => Assert.Equal(sizeof(long) * 12, Unsafe.SizeOf<Array12<long>>());
|
||||
|
||||
[Fact] public static void Array32SpanSizeIsCorrect() => Assert.Equal(32, new Array32<byte>().Items.Length);
|
||||
[Fact] public static void Array32SpanSizeIsCorrect() => Assert.Equal(32, new Array32<byte>().Length);
|
||||
[Fact] public static void Array32ByteSizeIsCorrect() => Assert.Equal(sizeof(byte) * 32, Unsafe.SizeOf<Array32<byte>>());
|
||||
[Fact] public static void Array32LongSizeIsCorrect() => Assert.Equal(sizeof(long) * 32, Unsafe.SizeOf<Array32<long>>());
|
||||
|
||||
[Fact] public static void Array64SpanSizeIsCorrect() => Assert.Equal(64, new Array64<byte>().Items.Length);
|
||||
[Fact] public static void Array64SpanSizeIsCorrect() => Assert.Equal(64, new Array64<byte>().Length);
|
||||
[Fact] public static void Array64ByteSizeIsCorrect() => Assert.Equal(sizeof(byte) * 64, Unsafe.SizeOf<Array64<byte>>());
|
||||
[Fact] public static void Array64LongSizeIsCorrect() => Assert.Equal(sizeof(long) * 64, Unsafe.SizeOf<Array64<long>>());
|
||||
|
||||
[Fact] public static void Array128SpanSizeIsCorrect() => Assert.Equal(128, new Array128<byte>().Items.Length);
|
||||
[Fact] public static void Array128SpanSizeIsCorrect() => Assert.Equal(128, new Array128<byte>().Length);
|
||||
[Fact] public static void Array128ByteSizeIsCorrect() => Assert.Equal(sizeof(byte) * 128, Unsafe.SizeOf<Array128<byte>>());
|
||||
[Fact] public static void Array128LongSizeIsCorrect() => Assert.Equal(sizeof(long) * 128, Unsafe.SizeOf<Array128<long>>());
|
||||
|
||||
[Fact] public static void Array256SpanSizeIsCorrect() => Assert.Equal(256, new Array256<byte>().Items.Length);
|
||||
[Fact] public static void Array256SpanSizeIsCorrect() => Assert.Equal(256, new Array256<byte>().Length);
|
||||
[Fact] public static void Array256ByteSizeIsCorrect() => Assert.Equal(sizeof(byte) * 256, Unsafe.SizeOf<Array256<byte>>());
|
||||
[Fact] public static void Array256LongSizeIsCorrect() => Assert.Equal(sizeof(long) * 256, Unsafe.SizeOf<Array256<long>>());
|
||||
}
|
|
@ -232,12 +232,12 @@ public class TypeLayoutTests
|
|||
Assert.Equal(NcaHeader.Size, Unsafe.SizeOf<NcaHeader>());
|
||||
Assert.Equal(NcaHeader.SectorSize, 1 << NcaHeader.SectorShift);
|
||||
|
||||
Assert.Equal(NcaHeader.HeaderSignSize, s.Signature1.ItemsRo.Length);
|
||||
Assert.Equal(NcaHeader.HeaderSignSize, s.Signature2.ItemsRo.Length);
|
||||
Assert.Equal(NcaHeader.RightsIdSize, s.RightsId.ItemsRo.Length);
|
||||
Assert.Equal(NcaHeader.FsCountMax, s.FsInfos.ItemsRo.Length);
|
||||
Assert.Equal(NcaHeader.FsCountMax, s.FsHeaderHashes.ItemsRo.Length);
|
||||
Assert.Equal(NcaHeader.EncryptedKeyAreaSize, s.EncryptedKeys.ItemsRo.Length);
|
||||
Assert.Equal(NcaHeader.HeaderSignSize, s.Signature1.Length);
|
||||
Assert.Equal(NcaHeader.HeaderSignSize, s.Signature2.Length);
|
||||
Assert.Equal(NcaHeader.RightsIdSize, s.RightsId.Length);
|
||||
Assert.Equal(NcaHeader.FsCountMax, s.FsInfos.Length);
|
||||
Assert.Equal(NcaHeader.FsCountMax, s.FsHeaderHashes.Length);
|
||||
Assert.Equal(NcaHeader.EncryptedKeyAreaSize, s.EncryptedKeys.Length);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -258,14 +258,14 @@ public class TypeLayoutTests
|
|||
{
|
||||
NcaCryptoConfiguration s = default;
|
||||
|
||||
Assert.Equal(NcaCryptoConfiguration.Header1SignatureKeyGenerationMax + 1, s.Header1SignKeyModuli.ItemsRo.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.Rsa2048KeyModulusSize, s.Header1SignKeyModuli.ItemsRo[0].ItemsRo.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.Rsa2048KeyPublicExponentSize, s.Header1SignKeyPublicExponent.ItemsRo.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.KeyAreaEncryptionKeyIndexCount, s.KeyAreaEncryptionKeySources.ItemsRo.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.Aes128KeySize, s.KeyAreaEncryptionKeySources.ItemsRo[0].ItemsRo.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.Aes128KeySize, s.HeaderEncryptionKeySource.ItemsRo.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.HeaderEncryptionKeyCount, s.HeaderEncryptedEncryptionKeys.ItemsRo.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.Aes128KeySize, s.HeaderEncryptedEncryptionKeys.ItemsRo[0].ItemsRo.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.Header1SignatureKeyGenerationMax + 1, s.Header1SignKeyModuli.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.Rsa2048KeyModulusSize, s.Header1SignKeyModuli[0].Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.Rsa2048KeyPublicExponentSize, s.Header1SignKeyPublicExponent.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.KeyAreaEncryptionKeyIndexCount, s.KeyAreaEncryptionKeySources.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.Aes128KeySize, s.KeyAreaEncryptionKeySources[0].Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.Aes128KeySize, s.HeaderEncryptionKeySource.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.HeaderEncryptionKeyCount, s.HeaderEncryptedEncryptionKeys.Length);
|
||||
Assert.Equal(NcaCryptoConfiguration.Aes128KeySize, s.HeaderEncryptedEncryptionKeys[0].Length);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -306,7 +306,7 @@ public class TypeLayoutTests
|
|||
Assert.Equal(0x04, GetOffset(in s, in s.Layers));
|
||||
Assert.Equal(0x94, GetOffset(in s, in s.HashSalt));
|
||||
|
||||
Assert.Equal(Constants.IntegrityMaxLayerCount - 1, s.Layers.ItemsRo.Length);
|
||||
Assert.Equal(Constants.IntegrityMaxLayerCount - 1, s.Layers.Length);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -327,7 +327,7 @@ public class TypeLayoutTests
|
|||
{
|
||||
HierarchicalIntegrityVerificationSizeSet s = default;
|
||||
|
||||
Assert.Equal(Constants.IntegrityMaxLayerCount - 2, s.LayeredHashSizes.ItemsRo.Length);
|
||||
Assert.Equal(Constants.IntegrityMaxLayerCount - 2, s.LayeredHashSizes.Length);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -335,7 +335,7 @@ public class TypeLayoutTests
|
|||
{
|
||||
HierarchicalIntegrityVerificationStorageControlArea.InputParam s = default;
|
||||
|
||||
Assert.Equal(Constants.IntegrityMaxLayerCount - 1, s.LevelBlockSizes.ItemsRo.Length);
|
||||
Assert.Equal(Constants.IntegrityMaxLayerCount - 1, s.LevelBlockSizes[..].Length);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
Loading…
Reference in a new issue