From 0d8e6dd4f8192ed48ea463fad86c09544ecca785 Mon Sep 17 00:00:00 2001 From: Gabriel A Date: Fri, 17 Nov 2023 20:33:02 -0300 Subject: [PATCH] Replace old ArrayN uses with new InlineArray structs --- .../Renderer/Dsp/DataSourceHelper.cs | 4 +- .../Renderer/Dsp/UpsamplerHelper.cs | 8 +- .../Parameter/Effect/LimiterStatistics.cs | 5 +- .../Renderer/Server/CommandGenerator.cs | 20 +- .../Renderer/Server/Sink/DeviceSink.cs | 4 +- .../Renderer/Server/StateUpdater.cs | 4 +- .../Server/Voice/VoiceChannelResource.cs | 3 +- .../Renderer/Server/Voice/VoiceState.cs | 10 +- .../Memory/PartialUnmaps/PartialUnmapState.cs | 2 +- .../Memory/PartialUnmaps/ThreadLocalMap.cs | 4 +- .../Memory/StructArrayHelpers.cs | 3877 ++++++++++++++--- src/Ryujinx.Graphics.Device/SizeCalculator.cs | 9 + .../Commands/SetPatchParametersCommand.cs | 6 +- .../ProgramPipelineState.cs | 2 +- .../Engine/Threed/StateUpdater.cs | 4 +- .../Memory/SupportBufferUpdater.cs | 2 +- .../Shader/DiskCache/DiskCacheGpuAccessor.cs | 2 +- .../Shader/GpuAccessor.cs | 2 +- .../Shader/ShaderSpecializationState.cs | 5 +- .../Shader/TransformFeedbackDescriptor.cs | 11 +- .../H264/SpsAndPpsReconstruction.cs | 2 +- src/Ryujinx.Graphics.Nvdec.Vp9/DecodeFrame.cs | 4 +- src/Ryujinx.Graphics.Nvdec.Vp9/DecodeMv.cs | 32 +- src/Ryujinx.Graphics.Nvdec.Vp9/LoopFilter.cs | 6 +- .../Image/SurfaceReader.cs | 12 +- src/Ryujinx.Graphics.Vulkan/BitMapStruct.cs | 22 +- .../DescriptorSetUpdater.cs | 8 +- src/Ryujinx.Graphics.Vulkan/PipelineBase.cs | 2 +- .../PipelineDynamicState.cs | 6 +- src/Ryujinx.Graphics.Vulkan/PipelineUid.cs | 8 +- .../Audio/IHardwareOpusDecoderManager.cs | 2 +- .../Friend/ServiceCreator/IFriendService.cs | 2 +- .../Services/Hid/HidDevices/KeyboardDevice.cs | 2 +- .../Services/Hid/HidDevices/NpadDevices.cs | 2 +- .../Hid/Types/SharedMemory/Common/RingLifo.cs | 3 + .../LdnMitm/LanDiscovery.cs | 19 +- .../LdnMitm/Proxy/LdnProxyUdpServer.cs | 2 +- .../HOS/Services/Mii/Types/CoreData.cs | 5 +- .../HOS/Services/Mii/Types/Nickname.cs | 5 +- .../Services/Mii/Types/RandomMiiConstants.cs | 10 +- .../HOS/Services/Mii/Types/Ver3StoreData.cs | 4 +- .../HOS/Services/Nfc/Nfp/NfpManager/INfp.cs | 2 +- .../HOS/Services/Nfc/Nfp/VirtualAmiibo.cs | 2 +- .../Nifm/StaticService/IGeneralService.cs | 2 +- .../Services/Sockets/Bsd/Types/BsdSockAddr.cs | 4 +- .../Sockets/Sfdnsres/Types/AddrInfo4.cs | 4 +- .../HOS/Services/Time/TimeZone/TimeZone.cs | 2 +- .../RootService/IApplicationDisplayService.cs | 4 +- src/Ryujinx.Input/Motion/CemuHook/Client.cs | 8 +- 49 files changed, 3484 insertions(+), 686 deletions(-) diff --git a/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs b/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs index 98657bd13..8a531a065 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs @@ -76,7 +76,7 @@ namespace Ryujinx.Audio.Renderer.Dsp if (!info.DecodingBehaviour.HasFlag(DecodingBehaviour.SkipPitchAndSampleRateConversion)) { - voiceState.Pitch.AsSpan()[..pitchMaxLength].CopyTo(tempBuffer); + voiceState.Pitch[..pitchMaxLength].CopyTo(tempBuffer); tempBufferIndex += pitchMaxLength; } @@ -239,7 +239,7 @@ namespace Ryujinx.Audio.Renderer.Dsp ResamplerHelper.Resample(outputBuffer, tempBuffer, sampleRateRatio, ref fraction, sampleCountToProcess, info.SrcQuality, y != sourceSampleCountToProcess || info.Pitch != 1.0f); - tempBuffer.Slice(sampleCountToDecode, pitchMaxLength).CopyTo(voiceState.Pitch.AsSpan()); + tempBuffer.Slice(sampleCountToDecode, pitchMaxLength).CopyTo(voiceState.Pitch); } i += sampleCountToProcess; diff --git a/src/Ryujinx.Audio/Renderer/Dsp/UpsamplerHelper.cs b/src/Ryujinx.Audio/Renderer/Dsp/UpsamplerHelper.cs index 5732cdb21..9068f0de3 100644 --- a/src/Ryujinx.Audio/Renderer/Dsp/UpsamplerHelper.cs +++ b/src/Ryujinx.Audio/Renderer/Dsp/UpsamplerHelper.cs @@ -71,7 +71,7 @@ namespace Ryujinx.Audio.Renderer.Dsp return; } - float DoFilterBank(ref UpsamplerBufferState state, in Array20 bank) + float DoFilterBank(ref UpsamplerBufferState state, ReadOnlySpan bank) { float result = 0.0f; @@ -87,8 +87,8 @@ namespace Ryujinx.Audio.Renderer.Dsp while (curIdx < stopIdx) { result += Vector.Dot( - new Vector(bank.AsSpan().Slice(curIdx, Vector.Count)), - new Vector(state.History.AsSpan().Slice(curIdx, Vector.Count))); + new Vector(bank.Slice(curIdx, Vector.Count)), + new Vector(((Span)state.History).Slice(curIdx, Vector.Count))); curIdx += Vector.Count; } } @@ -105,7 +105,7 @@ namespace Ryujinx.Audio.Renderer.Dsp [MethodImpl(MethodImplOptions.AggressiveInlining)] void NextInput(ref UpsamplerBufferState state, float input) { - state.History.AsSpan()[1..].CopyTo(state.History.AsSpan()); + state.History[1..].CopyTo(state.History); state.History[HistoryLength - 1] = input; } diff --git a/src/Ryujinx.Audio/Renderer/Parameter/Effect/LimiterStatistics.cs b/src/Ryujinx.Audio/Renderer/Parameter/Effect/LimiterStatistics.cs index 97e2f39fc..4709bef6d 100644 --- a/src/Ryujinx.Audio/Renderer/Parameter/Effect/LimiterStatistics.cs +++ b/src/Ryujinx.Audio/Renderer/Parameter/Effect/LimiterStatistics.cs @@ -1,4 +1,5 @@ using Ryujinx.Common.Memory; +using System; using System.Runtime.InteropServices; namespace Ryujinx.Audio.Renderer.Parameter.Effect @@ -24,8 +25,8 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect /// public void Reset() { - InputMax.AsSpan().Clear(); - CompressionGainMin.AsSpan().Fill(1.0f); + ((Span)InputMax).Clear(); + ((Span)CompressionGainMin).Fill(1.0f); } } } diff --git a/src/Ryujinx.Audio/Renderer/Server/CommandGenerator.cs b/src/Ryujinx.Audio/Renderer/Server/CommandGenerator.cs index ae8f699f3..476cb7c62 100644 --- a/src/Ryujinx.Audio/Renderer/Server/CommandGenerator.cs +++ b/src/Ryujinx.Audio/Renderer/Server/CommandGenerator.cs @@ -141,7 +141,7 @@ namespace Ryujinx.Audio.Renderer.Server Memory biquadStateRawMemory = SpanMemoryManager.Cast(state)[..(VoiceUpdateState.BiquadStateSize * Constants.VoiceBiquadFilterCount)]; Memory stateMemory = SpanMemoryManager.Cast(biquadStateRawMemory); - _commandBuffer.GenerateGroupedBiquadFilter(baseIndex, voiceState.BiquadFilters.AsSpan(), stateMemory, bufferOffset, bufferOffset, voiceState.BiquadFilterNeedInitialization, nodeId); + _commandBuffer.GenerateGroupedBiquadFilter(baseIndex, voiceState.BiquadFilters, stateMemory, bufferOffset, bufferOffset, voiceState.BiquadFilterNeedInitialization, nodeId); } else { @@ -337,8 +337,8 @@ namespace Ryujinx.Audio.Renderer.Server GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.Start, nodeId); } - GenerateVoiceMix(channelResource.Mix.AsSpan(), - channelResource.PreviousMix.AsSpan(), + GenerateVoiceMix(channelResource.Mix, + channelResource.PreviousMix, dspStateMemory, mix.BufferOffset, mix.BufferCount, @@ -507,8 +507,8 @@ namespace Ryujinx.Audio.Renderer.Server Enable = true, }; - effect.Parameter.Denominator.AsSpan().CopyTo(parameter.Denominator.AsSpan()); - effect.Parameter.Numerator.AsSpan().CopyTo(parameter.Numerator.AsSpan()); + ((Span)effect.Parameter.Denominator).CopyTo(parameter.Denominator); + ((Span)effect.Parameter.Numerator).CopyTo(parameter.Numerator); for (int i = 0; i < effect.Parameter.ChannelCount; i++) { @@ -939,8 +939,8 @@ namespace Ryujinx.Audio.Renderer.Server if (useCustomDownMixingCommand) { _commandBuffer.GenerateDownMixSurroundToStereo(finalMix.BufferOffset, - sink.Parameter.Input.AsSpan(), - sink.Parameter.Input.AsSpan(), + sink.Parameter.Input, + sink.Parameter.Input, sink.DownMixCoefficients, Constants.InvalidNodeId); } @@ -948,8 +948,8 @@ namespace Ryujinx.Audio.Renderer.Server else if (_rendererContext.ChannelCount == 2 && sink.Parameter.InputCount == 6) { _commandBuffer.GenerateDownMixSurroundToStereo(finalMix.BufferOffset, - sink.Parameter.Input.AsSpan(), - sink.Parameter.Input.AsSpan(), + sink.Parameter.Input, + sink.Parameter.Input, Constants.DefaultSurroundToStereoCoefficients, Constants.InvalidNodeId); } @@ -961,7 +961,7 @@ namespace Ryujinx.Audio.Renderer.Server _commandBuffer.GenerateUpsample(finalMix.BufferOffset, sink.UpsamplerState, sink.Parameter.InputCount, - sink.Parameter.Input.AsSpan(), + sink.Parameter.Input, commandList.BufferCount, commandList.SampleCount, commandList.SampleRate, diff --git a/src/Ryujinx.Audio/Renderer/Server/Sink/DeviceSink.cs b/src/Ryujinx.Audio/Renderer/Server/Sink/DeviceSink.cs index e03fe11d4..4cdbabf05 100644 --- a/src/Ryujinx.Audio/Renderer/Server/Sink/DeviceSink.cs +++ b/src/Ryujinx.Audio/Renderer/Server/Sink/DeviceSink.cs @@ -63,10 +63,10 @@ namespace Ryujinx.Audio.Renderer.Server.Sink else { Parameter.DownMixParameterEnabled = inputDeviceParameter.DownMixParameterEnabled; - inputDeviceParameter.DownMixParameter.AsSpan().CopyTo(Parameter.DownMixParameter.AsSpan()); + ((Span)inputDeviceParameter.DownMixParameter).CopyTo(Parameter.DownMixParameter); } - Parameter.DownMixParameter.AsSpan().CopyTo(DownMixCoefficients.AsSpan()); + ((Span)Parameter.DownMixParameter).CopyTo(DownMixCoefficients.AsSpan()); errorInfo = new BehaviourParameter.ErrorInfo(); outStatus = new SinkOutStatus(); diff --git a/src/Ryujinx.Audio/Renderer/Server/StateUpdater.cs b/src/Ryujinx.Audio/Renderer/Server/StateUpdater.cs index 22eebc7cc..af9f2d307 100644 --- a/src/Ryujinx.Audio/Renderer/Server/StateUpdater.cs +++ b/src/Ryujinx.Audio/Renderer/Server/StateUpdater.cs @@ -120,7 +120,7 @@ namespace Ryujinx.Audio.Renderer.Server ref VoiceChannelResource resource = ref context.GetChannelResource(i); resource.Id = parameter.Id; - parameter.Mix.AsSpan().CopyTo(resource.Mix.AsSpan()); + ((Span)parameter.Mix).CopyTo(resource.Mix); resource.IsUsed = parameter.IsUsed; } @@ -565,7 +565,7 @@ namespace Ryujinx.Audio.Renderer.Server { ref BehaviourErrorInfoOutStatus outStatus = ref SpanIOHelper.GetWriteRef(ref _output)[0]; - _behaviourContext.CopyErrorInfo(outStatus.ErrorInfos.AsSpan(), out outStatus.ErrorInfosCount); + _behaviourContext.CopyErrorInfo(outStatus.ErrorInfos, out outStatus.ErrorInfosCount); OutputHeader.BehaviourSize = (uint)Unsafe.SizeOf(); OutputHeader.TotalSize += OutputHeader.BehaviourSize; diff --git a/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceChannelResource.cs b/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceChannelResource.cs index e3d5f797d..b4d65b5c4 100644 --- a/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceChannelResource.cs +++ b/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceChannelResource.cs @@ -1,4 +1,5 @@ using Ryujinx.Common.Memory; +using System; using System.Runtime.InteropServices; namespace Ryujinx.Audio.Renderer.Server.Voice @@ -34,7 +35,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice public void UpdateState() { - Mix.AsSpan().CopyTo(PreviousMix.AsSpan()); + ((Span)Mix).CopyTo(PreviousMix); } } } diff --git a/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs b/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs index 225f7d31b..295bd777b 100644 --- a/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs +++ b/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs @@ -204,7 +204,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice Pitch = 0.0f; Volume = 0.0f; PreviousVolume = 0.0f; - BiquadFilters.AsSpan().Clear(); + ((Span)BiquadFilters).Clear(); WaveBuffersCount = 0; WaveBuffersIndex = 0; MixId = Constants.UnusedMixId; @@ -290,7 +290,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice ChannelsCount = parameter.ChannelCount; Pitch = parameter.Pitch; Volume = parameter.Volume; - parameter.BiquadFilters.AsSpan().CopyTo(BiquadFilters.AsSpan()); + ((Span)parameter.BiquadFilters).CopyTo(BiquadFilters); WaveBuffersCount = parameter.WaveBuffersCount; WaveBuffersIndex = parameter.WaveBuffersIndex; @@ -310,7 +310,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice SplitterId = Constants.UnusedSplitterId; } - parameter.ChannelResourceIds.AsSpan().CopyTo(ChannelResourceIds.AsSpan()); + ((Span)parameter.ChannelResourceIds).CopyTo(ChannelResourceIds); DecodingBehaviour behaviour = DecodingBehaviour.Default; @@ -640,7 +640,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice voiceUpdateState.Offset = 0; voiceUpdateState.PlayedSampleCount = 0; - voiceUpdateState.Pitch.AsSpan().Clear(); + ((Span)voiceUpdateState.Pitch).Clear(); voiceUpdateState.Fraction = 0; voiceUpdateState.LoopContext = new AdpcmLoopContext(); } @@ -652,7 +652,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice case PlayState.Stopped: case PlayState.Paused: - foreach (ref WaveBuffer wavebuffer in WaveBuffers.AsSpan()) + foreach (ref WaveBuffer wavebuffer in WaveBuffers) { wavebuffer.BufferAddressInfo.GetReference(true); wavebuffer.ContextAddressInfo.GetReference(true); diff --git a/src/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs b/src/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs index a583930b7..54b113710 100644 --- a/src/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs +++ b/src/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs @@ -129,7 +129,7 @@ namespace Ryujinx.Common.Memory.PartialUnmaps const uint ExitCodeStillActive = 259; const int ThreadQueryInformation = 0x40; - Span ids = LocalCounts.ThreadIds.AsSpan(); + Span ids = LocalCounts.ThreadIds; for (int i = 0; i < ids.Length; i++) { diff --git a/src/Ryujinx.Common/Memory/PartialUnmaps/ThreadLocalMap.cs b/src/Ryujinx.Common/Memory/PartialUnmaps/ThreadLocalMap.cs index a3c3dc57b..706987048 100644 --- a/src/Ryujinx.Common/Memory/PartialUnmaps/ThreadLocalMap.cs +++ b/src/Ryujinx.Common/Memory/PartialUnmaps/ThreadLocalMap.cs @@ -1,4 +1,5 @@ -using System.Runtime.InteropServices; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; using System.Threading; using static Ryujinx.Common.Memory.PartialUnmaps.PartialUnmapHelpers; @@ -74,6 +75,7 @@ namespace Ryujinx.Common.Memory.PartialUnmaps /// /// Index of the entry /// A reference to the struct value + [UnscopedRef] public ref T GetValue(int index) { return ref Structs[index]; diff --git a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs index 807bd69c3..8275d2473 100644 --- a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs +++ b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs @@ -1,836 +1,3609 @@ -using System; -using System.Diagnostics.Contracts; -using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; -#pragma warning disable CS0169, IDE0051 // Remove unused private member namespace Ryujinx.Common.Memory { - public struct Array1 : IArray where T : unmanaged + [InlineArray(1)] + public struct Array1 { - T _e0; public readonly int Length => 1; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array2 : IArray where T : unmanaged + [InlineArray(2)] + public struct Array2 { - T _e0; - Array1 _other; public readonly int Length => 2; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array3 : IArray where T : unmanaged + [InlineArray(3)] + public struct Array3 { - T _e0; - Array2 _other; public readonly int Length => 3; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array4 : IArray where T : unmanaged + [InlineArray(4)] + public struct Array4 { - T _e0; - Array3 _other; public readonly int Length => 4; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array5 : IArray where T : unmanaged + [InlineArray(5)] + public struct Array5 { - T _e0; - Array4 _other; public readonly int Length => 5; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array6 : IArray where T : unmanaged + [InlineArray(6)] + public struct Array6 { - T _e0; - Array5 _other; public readonly int Length => 6; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array7 : IArray where T : unmanaged + [InlineArray(7)] + public struct Array7 { - T _e0; - Array6 _other; public readonly int Length => 7; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array8 : IArray where T : unmanaged + [InlineArray(8)] + public struct Array8 { - T _e0; - Array7 _other; public readonly int Length => 8; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array9 : IArray where T : unmanaged + [InlineArray(9)] + public struct Array9 { - T _e0; - Array8 _other; public readonly int Length => 9; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array10 : IArray where T : unmanaged + [InlineArray(10)] + public struct Array10 { - T _e0; - Array9 _other; public readonly int Length => 10; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array11 : IArray where T : unmanaged + [InlineArray(11)] + public struct Array11 { - T _e0; - Array10 _other; public readonly int Length => 11; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array12 : IArray where T : unmanaged + [InlineArray(12)] + public struct Array12 { - T _e0; - Array11 _other; public readonly int Length => 12; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array13 : IArray where T : unmanaged + [InlineArray(13)] + public struct Array13 { - T _e0; - Array12 _other; public readonly int Length => 13; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array14 : IArray where T : unmanaged + [InlineArray(14)] + public struct Array14 { - T _e0; - Array13 _other; public readonly int Length => 14; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array15 : IArray where T : unmanaged + [InlineArray(15)] + public struct Array15 { - T _e0; - Array14 _other; public readonly int Length => 15; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array16 : IArray where T : unmanaged + [InlineArray(16)] + public struct Array16 { - T _e0; - Array15 _other; public readonly int Length => 16; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array17 : IArray where T : unmanaged + [InlineArray(17)] + public struct Array17 { - T _e0; - Array16 _other; public readonly int Length => 17; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array18 : IArray where T : unmanaged + [InlineArray(18)] + public struct Array18 { - T _e0; - Array17 _other; public readonly int Length => 18; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array19 : IArray where T : unmanaged + [InlineArray(19)] + public struct Array19 { - T _e0; - Array18 _other; public readonly int Length => 19; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array20 : IArray where T : unmanaged + [InlineArray(20)] + public struct Array20 { - T _e0; - Array19 _other; public readonly int Length => 20; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array21 : IArray where T : unmanaged + [InlineArray(21)] + public struct Array21 { - T _e0; - Array20 _other; public readonly int Length => 21; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array22 : IArray where T : unmanaged + [InlineArray(22)] + public struct Array22 { - T _e0; - Array21 _other; public readonly int Length => 22; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array23 : IArray where T : unmanaged + [InlineArray(23)] + public struct Array23 { - T _e0; - Array22 _other; public readonly int Length => 23; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array24 : IArray where T : unmanaged + [InlineArray(24)] + public struct Array24 { - T _e0; - Array23 _other; - public readonly int Length => 24; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array25 : IArray where T : unmanaged + [InlineArray(25)] + public struct Array25 { - T _e0; - Array24 _other; - public readonly int Length => 25; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array26 : IArray where T : unmanaged + [InlineArray(26)] + public struct Array26 { - T _e0; - Array25 _other; - public readonly int Length => 26; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array27 : IArray where T : unmanaged + [InlineArray(27)] + public struct Array27 { - T _e0; - Array26 _other; - public readonly int Length => 27; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array28 : IArray where T : unmanaged + [InlineArray(28)] + public struct Array28 { - T _e0; - Array27 _other; - public readonly int Length => 28; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array29 : IArray where T : unmanaged + [InlineArray(29)] + public struct Array29 { - T _e0; - Array28 _other; - public readonly int Length => 29; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array30 : IArray where T : unmanaged + [InlineArray(30)] + public struct Array30 { - T _e0; - Array29 _other; - public readonly int Length => 30; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array31 : IArray where T : unmanaged + [InlineArray(31)] + public struct Array31 { - T _e0; - Array30 _other; - public readonly int Length => 31; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array32 : IArray where T : unmanaged + [InlineArray(32)] + public struct Array32 { - T _e0; - Array31 _other; - public readonly int Length => 32; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array33 : IArray where T : unmanaged + [InlineArray(33)] + public struct Array33 { - T _e0; - Array32 _other; - public readonly int Length => 33; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array34 : IArray where T : unmanaged + [InlineArray(34)] + public struct Array34 { - T _e0; - Array33 _other; - public readonly int Length => 34; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array35 : IArray where T : unmanaged + [InlineArray(35)] + public struct Array35 { - T _e0; - Array34 _other; - public readonly int Length => 35; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array36 : IArray where T : unmanaged + [InlineArray(36)] + public struct Array36 { - T _e0; - Array35 _other; - public readonly int Length => 36; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array37 : IArray where T : unmanaged + [InlineArray(37)] + public struct Array37 { - T _e0; - Array36 _other; - public readonly int Length => 37; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array38 : IArray where T : unmanaged + [InlineArray(38)] + public struct Array38 { - T _e0; - Array37 _other; - public readonly int Length => 38; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array39 : IArray where T : unmanaged + [InlineArray(39)] + public struct Array39 { - T _e0; - Array38 _other; - public readonly int Length => 39; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array40 : IArray where T : unmanaged + [InlineArray(40)] + public struct Array40 { - T _e0; - Array39 _other; - public readonly int Length => 40; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array41 : IArray where T : unmanaged + [InlineArray(41)] + public struct Array41 { - T _e0; - Array40 _other; - public readonly int Length => 41; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array42 : IArray where T : unmanaged + [InlineArray(42)] + public struct Array42 { - T _e0; - Array41 _other; - public readonly int Length => 42; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array43 : IArray where T : unmanaged + [InlineArray(43)] + public struct Array43 { - T _e0; - Array42 _other; - public readonly int Length => 43; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array44 : IArray where T : unmanaged + [InlineArray(44)] + public struct Array44 { - T _e0; - Array43 _other; - public readonly int Length => 44; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array45 : IArray where T : unmanaged + [InlineArray(45)] + public struct Array45 { - T _e0; - Array44 _other; - public readonly int Length => 45; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array46 : IArray where T : unmanaged + [InlineArray(46)] + public struct Array46 { - T _e0; - Array45 _other; - public readonly int Length => 46; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array47 : IArray where T : unmanaged + [InlineArray(47)] + public struct Array47 { - T _e0; - Array46 _other; - public readonly int Length => 47; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array48 : IArray where T : unmanaged + [InlineArray(48)] + public struct Array48 { - T _e0; - Array47 _other; - public readonly int Length => 48; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array49 : IArray where T : unmanaged + [InlineArray(49)] + public struct Array49 { - T _e0; - Array48 _other; - public readonly int Length => 49; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array50 : IArray where T : unmanaged + [InlineArray(50)] + public struct Array50 { - T _e0; - Array49 _other; - public readonly int Length => 50; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array51 : IArray where T : unmanaged + [InlineArray(51)] + public struct Array51 { - T _e0; - Array50 _other; - public readonly int Length => 51; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array52 : IArray where T : unmanaged + [InlineArray(52)] + public struct Array52 { - T _e0; - Array51 _other; - public readonly int Length => 52; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array53 : IArray where T : unmanaged + [InlineArray(53)] + public struct Array53 { - T _e0; - Array52 _other; - public readonly int Length => 53; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array54 : IArray where T : unmanaged + [InlineArray(54)] + public struct Array54 { - T _e0; - Array53 _other; - public readonly int Length => 54; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array55 : IArray where T : unmanaged + [InlineArray(55)] + public struct Array55 { - T _e0; - Array54 _other; - public readonly int Length => 55; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array56 : IArray where T : unmanaged + [InlineArray(56)] + public struct Array56 { - T _e0; - Array55 _other; - public readonly int Length => 56; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array57 : IArray where T : unmanaged + [InlineArray(57)] + public struct Array57 { - T _e0; - Array56 _other; - public readonly int Length => 57; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array58 : IArray where T : unmanaged + [InlineArray(58)] + public struct Array58 { - T _e0; - Array57 _other; - public readonly int Length => 58; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array59 : IArray where T : unmanaged + [InlineArray(59)] + public struct Array59 { - T _e0; - Array58 _other; - public readonly int Length => 59; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array60 : IArray where T : unmanaged + [InlineArray(60)] + public struct Array60 { - T _e0; - Array59 _other; public readonly int Length => 60; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array61 : IArray where T : unmanaged + [InlineArray(61)] + public struct Array61 { - T _e0; - Array60 _other; public readonly int Length => 61; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array62 : IArray where T : unmanaged + [InlineArray(62)] + public struct Array62 { - T _e0; - Array61 _other; public readonly int Length => 62; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array63 : IArray where T : unmanaged + [InlineArray(63)] + public struct Array63 { - T _e0; - Array62 _other; public readonly int Length => 63; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array64 : IArray where T : unmanaged + [InlineArray(64)] + public struct Array64 { - T _e0; - Array63 _other; public readonly int Length => 64; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array73 : IArray where T : unmanaged + [InlineArray(65)] + public struct Array65 + { + public readonly int Length => 65; + private T _element; + } + + [InlineArray(66)] + public struct Array66 + { + public readonly int Length => 66; + private T _element; + } + + [InlineArray(67)] + public struct Array67 + { + public readonly int Length => 67; + private T _element; + } + + [InlineArray(68)] + public struct Array68 + { + public readonly int Length => 68; + private T _element; + } + + [InlineArray(69)] + public struct Array69 + { + public readonly int Length => 69; + private T _element; + } + + [InlineArray(70)] + public struct Array70 + { + public readonly int Length => 70; + private T _element; + } + + [InlineArray(71)] + public struct Array71 + { + public readonly int Length => 71; + private T _element; + } + + [InlineArray(72)] + public struct Array72 + { + public readonly int Length => 72; + private T _element; + } + + [InlineArray(73)] + public struct Array73 { - T _e0; - Array64 _other; - Array8 _other2; public readonly int Length => 73; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array96 : IArray where T : unmanaged + [InlineArray(74)] + public struct Array74 + { + public readonly int Length => 74; + private T _element; + } + + [InlineArray(75)] + public struct Array75 + { + public readonly int Length => 75; + private T _element; + } + + [InlineArray(76)] + public struct Array76 + { + public readonly int Length => 76; + private T _element; + } + + [InlineArray(77)] + public struct Array77 + { + public readonly int Length => 77; + private T _element; + } + + [InlineArray(78)] + public struct Array78 + { + public readonly int Length => 78; + private T _element; + } + + [InlineArray(79)] + public struct Array79 + { + public readonly int Length => 79; + private T _element; + } + + [InlineArray(80)] + public struct Array80 + { + public readonly int Length => 80; + private T _element; + } + + [InlineArray(81)] + public struct Array81 + { + public readonly int Length => 81; + private T _element; + } + + [InlineArray(82)] + public struct Array82 + { + public readonly int Length => 82; + private T _element; + } + + [InlineArray(83)] + public struct Array83 + { + public readonly int Length => 83; + private T _element; + } + + [InlineArray(84)] + public struct Array84 + { + public readonly int Length => 84; + private T _element; + } + + [InlineArray(85)] + public struct Array85 + { + public readonly int Length => 85; + private T _element; + } + + [InlineArray(86)] + public struct Array86 + { + public readonly int Length => 86; + private T _element; + } + + [InlineArray(87)] + public struct Array87 + { + public readonly int Length => 87; + private T _element; + } + + [InlineArray(88)] + public struct Array88 + { + public readonly int Length => 88; + private T _element; + } + + [InlineArray(89)] + public struct Array89 + { + public readonly int Length => 89; + private T _element; + } + + [InlineArray(90)] + public struct Array90 + { + public readonly int Length => 90; + private T _element; + } + + [InlineArray(91)] + public struct Array91 + { + public readonly int Length => 91; + private T _element; + } + + [InlineArray(92)] + public struct Array92 + { + public readonly int Length => 92; + private T _element; + } + + [InlineArray(93)] + public struct Array93 + { + public readonly int Length => 93; + private T _element; + } + + [InlineArray(94)] + public struct Array94 + { + public readonly int Length => 94; + private T _element; + } + + [InlineArray(95)] + public struct Array95 + { + public readonly int Length => 95; + private T _element; + } + + [InlineArray(96)] + public struct Array96 { - T _e0; - Array64 _other; - Array31 _other2; public readonly int Length => 96; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array127 : IArray where T : unmanaged + [InlineArray(97)] + public struct Array97 + { + public readonly int Length => 97; + private T _element; + } + + [InlineArray(98)] + public struct Array98 + { + public readonly int Length => 98; + private T _element; + } + + [InlineArray(99)] + public struct Array99 + { + public readonly int Length => 99; + private T _element; + } + + [InlineArray(100)] + public struct Array100 + { + public readonly int Length => 100; + private T _element; + } + + [InlineArray(101)] + public struct Array101 + { + public readonly int Length => 101; + private T _element; + } + + [InlineArray(102)] + public struct Array102 + { + public readonly int Length => 102; + private T _element; + } + + [InlineArray(103)] + public struct Array103 + { + public readonly int Length => 103; + private T _element; + } + + [InlineArray(104)] + public struct Array104 + { + public readonly int Length => 104; + private T _element; + } + + [InlineArray(105)] + public struct Array105 + { + public readonly int Length => 105; + private T _element; + } + + [InlineArray(106)] + public struct Array106 + { + public readonly int Length => 106; + private T _element; + } + + [InlineArray(107)] + public struct Array107 + { + public readonly int Length => 107; + private T _element; + } + + [InlineArray(108)] + public struct Array108 + { + public readonly int Length => 108; + private T _element; + } + + [InlineArray(109)] + public struct Array109 + { + public readonly int Length => 109; + private T _element; + } + + [InlineArray(110)] + public struct Array110 + { + public readonly int Length => 110; + private T _element; + } + + [InlineArray(111)] + public struct Array111 + { + public readonly int Length => 111; + private T _element; + } + + [InlineArray(112)] + public struct Array112 + { + public readonly int Length => 112; + private T _element; + } + + [InlineArray(113)] + public struct Array113 + { + public readonly int Length => 113; + private T _element; + } + + [InlineArray(114)] + public struct Array114 + { + public readonly int Length => 114; + private T _element; + } + + [InlineArray(115)] + public struct Array115 + { + public readonly int Length => 115; + private T _element; + } + + [InlineArray(116)] + public struct Array116 + { + public readonly int Length => 116; + private T _element; + } + + [InlineArray(117)] + public struct Array117 + { + public readonly int Length => 117; + private T _element; + } + + [InlineArray(118)] + public struct Array118 + { + public readonly int Length => 118; + private T _element; + } + + [InlineArray(119)] + public struct Array119 + { + public readonly int Length => 119; + private T _element; + } + + [InlineArray(120)] + public struct Array120 + { + public readonly int Length => 120; + private T _element; + } + + [InlineArray(121)] + public struct Array121 + { + public readonly int Length => 121; + private T _element; + } + + [InlineArray(122)] + public struct Array122 + { + public readonly int Length => 122; + private T _element; + } + + [InlineArray(123)] + public struct Array123 + { + public readonly int Length => 123; + private T _element; + } + + [InlineArray(124)] + public struct Array124 + { + public readonly int Length => 124; + private T _element; + } + + [InlineArray(125)] + public struct Array125 + { + public readonly int Length => 125; + private T _element; + } + + [InlineArray(126)] + public struct Array126 + { + public readonly int Length => 126; + private T _element; + } + + [InlineArray(127)] + public struct Array127 { - T _e0; - Array64 _other; - Array62 _other2; public readonly int Length => 127; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array128 : IArray where T : unmanaged + [InlineArray(128)] + public struct Array128 { - T _e0; - Array64 _other; - Array63 _other2; public readonly int Length => 128; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array256 : IArray where T : unmanaged + [InlineArray(129)] + public struct Array129 { - T _e0; - Array128 _other; - Array127 _other2; - public readonly int Length => 256; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + public readonly int Length => 129; + private T _element; } - public struct Array140 : IArray where T : unmanaged + [InlineArray(130)] + public struct Array130 + { + public readonly int Length => 130; + private T _element; + } + + [InlineArray(131)] + public struct Array131 + { + public readonly int Length => 131; + private T _element; + } + + [InlineArray(132)] + public struct Array132 + { + public readonly int Length => 132; + private T _element; + } + + [InlineArray(133)] + public struct Array133 + { + public readonly int Length => 133; + private T _element; + } + + [InlineArray(134)] + public struct Array134 + { + public readonly int Length => 134; + private T _element; + } + + [InlineArray(135)] + public struct Array135 + { + public readonly int Length => 135; + private T _element; + } + + [InlineArray(136)] + public struct Array136 + { + public readonly int Length => 136; + private T _element; + } + + [InlineArray(137)] + public struct Array137 + { + public readonly int Length => 137; + private T _element; + } + + [InlineArray(138)] + public struct Array138 + { + public readonly int Length => 138; + private T _element; + } + + [InlineArray(139)] + public struct Array139 + { + public readonly int Length => 139; + private T _element; + } + + [InlineArray(140)] + public struct Array140 { - T _e0; - Array64 _other; - Array64 _other2; - Array11 _other3; public readonly int Length => 140; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + private T _element; } - public struct Array384 : IArray where T : unmanaged + [InlineArray(141)] + public struct Array141 { - T _e0; - Array64 _other; - Array64 _other2; - Array64 _other3; - Array64 _other4; - Array64 _other5; - Array63 _other6; - public readonly int Length => 384; - public ref T this[int index] => ref AsSpan()[index]; - - [Pure] - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + public readonly int Length => 141; + private T _element; } -} -#pragma warning restore CS0169, IDE0051 + + [InlineArray(142)] + public struct Array142 + { + public readonly int Length => 142; + private T _element; + } + + [InlineArray(143)] + public struct Array143 + { + public readonly int Length => 143; + private T _element; + } + + [InlineArray(144)] + public struct Array144 + { + public readonly int Length => 144; + private T _element; + } + + [InlineArray(145)] + public struct Array145 + { + public readonly int Length => 145; + private T _element; + } + + [InlineArray(146)] + public struct Array146 + { + public readonly int Length => 146; + private T _element; + } + + [InlineArray(147)] + public struct Array147 + { + public readonly int Length => 147; + private T _element; + } + + [InlineArray(148)] + public struct Array148 + { + public readonly int Length => 148; + private T _element; + } + + [InlineArray(149)] + public struct Array149 + { + public readonly int Length => 149; + private T _element; + } + + [InlineArray(150)] + public struct Array150 + { + public readonly int Length => 150; + private T _element; + } + + [InlineArray(151)] + public struct Array151 + { + public readonly int Length => 151; + private T _element; + } + + [InlineArray(152)] + public struct Array152 + { + public readonly int Length => 152; + private T _element; + } + + [InlineArray(153)] + public struct Array153 + { + public readonly int Length => 153; + private T _element; + } + + [InlineArray(154)] + public struct Array154 + { + public readonly int Length => 154; + private T _element; + } + + [InlineArray(155)] + public struct Array155 + { + public readonly int Length => 155; + private T _element; + } + + [InlineArray(156)] + public struct Array156 + { + public readonly int Length => 156; + private T _element; + } + + [InlineArray(157)] + public struct Array157 + { + public readonly int Length => 157; + private T _element; + } + + [InlineArray(158)] + public struct Array158 + { + public readonly int Length => 158; + private T _element; + } + + [InlineArray(159)] + public struct Array159 + { + public readonly int Length => 159; + private T _element; + } + + [InlineArray(160)] + public struct Array160 + { + public readonly int Length => 160; + private T _element; + } + + [InlineArray(161)] + public struct Array161 + { + public readonly int Length => 161; + private T _element; + } + + [InlineArray(162)] + public struct Array162 + { + public readonly int Length => 162; + private T _element; + } + + [InlineArray(163)] + public struct Array163 + { + public readonly int Length => 163; + private T _element; + } + + [InlineArray(164)] + public struct Array164 + { + public readonly int Length => 164; + private T _element; + } + + [InlineArray(165)] + public struct Array165 + { + public readonly int Length => 165; + private T _element; + } + + [InlineArray(166)] + public struct Array166 + { + public readonly int Length => 166; + private T _element; + } + + [InlineArray(167)] + public struct Array167 + { + public readonly int Length => 167; + private T _element; + } + + [InlineArray(168)] + public struct Array168 + { + public readonly int Length => 168; + private T _element; + } + + [InlineArray(169)] + public struct Array169 + { + public readonly int Length => 169; + private T _element; + } + + [InlineArray(170)] + public struct Array170 + { + public readonly int Length => 170; + private T _element; + } + + [InlineArray(171)] + public struct Array171 + { + public readonly int Length => 171; + private T _element; + } + + [InlineArray(172)] + public struct Array172 + { + public readonly int Length => 172; + private T _element; + } + + [InlineArray(173)] + public struct Array173 + { + public readonly int Length => 173; + private T _element; + } + + [InlineArray(174)] + public struct Array174 + { + public readonly int Length => 174; + private T _element; + } + + [InlineArray(175)] + public struct Array175 + { + public readonly int Length => 175; + private T _element; + } + + [InlineArray(176)] + public struct Array176 + { + public readonly int Length => 176; + private T _element; + } + + [InlineArray(177)] + public struct Array177 + { + public readonly int Length => 177; + private T _element; + } + + [InlineArray(178)] + public struct Array178 + { + public readonly int Length => 178; + private T _element; + } + + [InlineArray(179)] + public struct Array179 + { + public readonly int Length => 179; + private T _element; + } + + [InlineArray(180)] + public struct Array180 + { + public readonly int Length => 180; + private T _element; + } + + [InlineArray(181)] + public struct Array181 + { + public readonly int Length => 181; + private T _element; + } + + [InlineArray(182)] + public struct Array182 + { + public readonly int Length => 182; + private T _element; + } + + [InlineArray(183)] + public struct Array183 + { + public readonly int Length => 183; + private T _element; + } + + [InlineArray(184)] + public struct Array184 + { + public readonly int Length => 184; + private T _element; + } + + [InlineArray(185)] + public struct Array185 + { + public readonly int Length => 185; + private T _element; + } + + [InlineArray(186)] + public struct Array186 + { + public readonly int Length => 186; + private T _element; + } + + [InlineArray(187)] + public struct Array187 + { + public readonly int Length => 187; + private T _element; + } + + [InlineArray(188)] + public struct Array188 + { + public readonly int Length => 188; + private T _element; + } + + [InlineArray(189)] + public struct Array189 + { + public readonly int Length => 189; + private T _element; + } + + [InlineArray(190)] + public struct Array190 + { + public readonly int Length => 190; + private T _element; + } + + [InlineArray(191)] + public struct Array191 + { + public readonly int Length => 191; + private T _element; + } + + [InlineArray(192)] + public struct Array192 + { + public readonly int Length => 192; + private T _element; + } + + [InlineArray(193)] + public struct Array193 + { + public readonly int Length => 193; + private T _element; + } + + [InlineArray(194)] + public struct Array194 + { + public readonly int Length => 194; + private T _element; + } + + [InlineArray(195)] + public struct Array195 + { + public readonly int Length => 195; + private T _element; + } + + [InlineArray(196)] + public struct Array196 + { + public readonly int Length => 196; + private T _element; + } + + [InlineArray(197)] + public struct Array197 + { + public readonly int Length => 197; + private T _element; + } + + [InlineArray(198)] + public struct Array198 + { + public readonly int Length => 198; + private T _element; + } + + [InlineArray(199)] + public struct Array199 + { + public readonly int Length => 199; + private T _element; + } + + [InlineArray(200)] + public struct Array200 + { + public readonly int Length => 200; + private T _element; + } + + [InlineArray(201)] + public struct Array201 + { + public readonly int Length => 201; + private T _element; + } + + [InlineArray(202)] + public struct Array202 + { + public readonly int Length => 202; + private T _element; + } + + [InlineArray(203)] + public struct Array203 + { + public readonly int Length => 203; + private T _element; + } + + [InlineArray(204)] + public struct Array204 + { + public readonly int Length => 204; + private T _element; + } + + [InlineArray(205)] + public struct Array205 + { + public readonly int Length => 205; + private T _element; + } + + [InlineArray(206)] + public struct Array206 + { + public readonly int Length => 206; + private T _element; + } + + [InlineArray(207)] + public struct Array207 + { + public readonly int Length => 207; + private T _element; + } + + [InlineArray(208)] + public struct Array208 + { + public readonly int Length => 208; + private T _element; + } + + [InlineArray(209)] + public struct Array209 + { + public readonly int Length => 209; + private T _element; + } + + [InlineArray(210)] + public struct Array210 + { + public readonly int Length => 210; + private T _element; + } + + [InlineArray(211)] + public struct Array211 + { + public readonly int Length => 211; + private T _element; + } + + [InlineArray(212)] + public struct Array212 + { + public readonly int Length => 212; + private T _element; + } + + [InlineArray(213)] + public struct Array213 + { + public readonly int Length => 213; + private T _element; + } + + [InlineArray(214)] + public struct Array214 + { + public readonly int Length => 214; + private T _element; + } + + [InlineArray(215)] + public struct Array215 + { + public readonly int Length => 215; + private T _element; + } + + [InlineArray(216)] + public struct Array216 + { + public readonly int Length => 216; + private T _element; + } + + [InlineArray(217)] + public struct Array217 + { + public readonly int Length => 217; + private T _element; + } + + [InlineArray(218)] + public struct Array218 + { + public readonly int Length => 218; + private T _element; + } + + [InlineArray(219)] + public struct Array219 + { + public readonly int Length => 219; + private T _element; + } + + [InlineArray(220)] + public struct Array220 + { + public readonly int Length => 220; + private T _element; + } + + [InlineArray(221)] + public struct Array221 + { + public readonly int Length => 221; + private T _element; + } + + [InlineArray(222)] + public struct Array222 + { + public readonly int Length => 222; + private T _element; + } + + [InlineArray(223)] + public struct Array223 + { + public readonly int Length => 223; + private T _element; + } + + [InlineArray(224)] + public struct Array224 + { + public readonly int Length => 224; + private T _element; + } + + [InlineArray(225)] + public struct Array225 + { + public readonly int Length => 225; + private T _element; + } + + [InlineArray(226)] + public struct Array226 + { + public readonly int Length => 226; + private T _element; + } + + [InlineArray(227)] + public struct Array227 + { + public readonly int Length => 227; + private T _element; + } + + [InlineArray(228)] + public struct Array228 + { + public readonly int Length => 228; + private T _element; + } + + [InlineArray(229)] + public struct Array229 + { + public readonly int Length => 229; + private T _element; + } + + [InlineArray(230)] + public struct Array230 + { + public readonly int Length => 230; + private T _element; + } + + [InlineArray(231)] + public struct Array231 + { + public readonly int Length => 231; + private T _element; + } + + [InlineArray(232)] + public struct Array232 + { + public readonly int Length => 232; + private T _element; + } + + [InlineArray(233)] + public struct Array233 + { + public readonly int Length => 233; + private T _element; + } + + [InlineArray(234)] + public struct Array234 + { + public readonly int Length => 234; + private T _element; + } + + [InlineArray(235)] + public struct Array235 + { + public readonly int Length => 235; + private T _element; + } + + [InlineArray(236)] + public struct Array236 + { + public readonly int Length => 236; + private T _element; + } + + [InlineArray(237)] + public struct Array237 + { + public readonly int Length => 237; + private T _element; + } + + [InlineArray(238)] + public struct Array238 + { + public readonly int Length => 238; + private T _element; + } + + [InlineArray(239)] + public struct Array239 + { + public readonly int Length => 239; + private T _element; + } + + [InlineArray(240)] + public struct Array240 + { + public readonly int Length => 240; + private T _element; + } + + [InlineArray(241)] + public struct Array241 + { + public readonly int Length => 241; + private T _element; + } + + [InlineArray(242)] + public struct Array242 + { + public readonly int Length => 242; + private T _element; + } + + [InlineArray(243)] + public struct Array243 + { + public readonly int Length => 243; + private T _element; + } + + [InlineArray(244)] + public struct Array244 + { + public readonly int Length => 244; + private T _element; + } + + [InlineArray(245)] + public struct Array245 + { + public readonly int Length => 245; + private T _element; + } + + [InlineArray(246)] + public struct Array246 + { + public readonly int Length => 246; + private T _element; + } + + [InlineArray(247)] + public struct Array247 + { + public readonly int Length => 247; + private T _element; + } + + [InlineArray(248)] + public struct Array248 + { + public readonly int Length => 248; + private T _element; + } + + [InlineArray(249)] + public struct Array249 + { + public readonly int Length => 249; + private T _element; + } + + [InlineArray(250)] + public struct Array250 + { + public readonly int Length => 250; + private T _element; + } + + [InlineArray(251)] + public struct Array251 + { + public readonly int Length => 251; + private T _element; + } + + [InlineArray(252)] + public struct Array252 + { + public readonly int Length => 252; + private T _element; + } + + [InlineArray(253)] + public struct Array253 + { + public readonly int Length => 253; + private T _element; + } + + [InlineArray(254)] + public struct Array254 + { + public readonly int Length => 254; + private T _element; + } + + [InlineArray(255)] + public struct Array255 + { + public readonly int Length => 255; + private T _element; + } + + [InlineArray(256)] + public struct Array256 + { + public readonly int Length => 256; + private T _element; + } + + [InlineArray(257)] + public struct Array257 + { + public readonly int Length => 257; + private T _element; + } + + [InlineArray(258)] + public struct Array258 + { + public readonly int Length => 258; + private T _element; + } + + [InlineArray(259)] + public struct Array259 + { + public readonly int Length => 259; + private T _element; + } + + [InlineArray(260)] + public struct Array260 + { + public readonly int Length => 260; + private T _element; + } + + [InlineArray(261)] + public struct Array261 + { + public readonly int Length => 261; + private T _element; + } + + [InlineArray(262)] + public struct Array262 + { + public readonly int Length => 262; + private T _element; + } + + [InlineArray(263)] + public struct Array263 + { + public readonly int Length => 263; + private T _element; + } + + [InlineArray(264)] + public struct Array264 + { + public readonly int Length => 264; + private T _element; + } + + [InlineArray(265)] + public struct Array265 + { + public readonly int Length => 265; + private T _element; + } + + [InlineArray(266)] + public struct Array266 + { + public readonly int Length => 266; + private T _element; + } + + [InlineArray(267)] + public struct Array267 + { + public readonly int Length => 267; + private T _element; + } + + [InlineArray(268)] + public struct Array268 + { + public readonly int Length => 268; + private T _element; + } + + [InlineArray(269)] + public struct Array269 + { + public readonly int Length => 269; + private T _element; + } + + [InlineArray(270)] + public struct Array270 + { + public readonly int Length => 270; + private T _element; + } + + [InlineArray(271)] + public struct Array271 + { + public readonly int Length => 271; + private T _element; + } + + [InlineArray(272)] + public struct Array272 + { + public readonly int Length => 272; + private T _element; + } + + [InlineArray(273)] + public struct Array273 + { + public readonly int Length => 273; + private T _element; + } + + [InlineArray(274)] + public struct Array274 + { + public readonly int Length => 274; + private T _element; + } + + [InlineArray(275)] + public struct Array275 + { + public readonly int Length => 275; + private T _element; + } + + [InlineArray(276)] + public struct Array276 + { + public readonly int Length => 276; + private T _element; + } + + [InlineArray(277)] + public struct Array277 + { + public readonly int Length => 277; + private T _element; + } + + [InlineArray(278)] + public struct Array278 + { + public readonly int Length => 278; + private T _element; + } + + [InlineArray(279)] + public struct Array279 + { + public readonly int Length => 279; + private T _element; + } + + [InlineArray(280)] + public struct Array280 + { + public readonly int Length => 280; + private T _element; + } + + [InlineArray(281)] + public struct Array281 + { + public readonly int Length => 281; + private T _element; + } + + [InlineArray(282)] + public struct Array282 + { + public readonly int Length => 282; + private T _element; + } + + [InlineArray(283)] + public struct Array283 + { + public readonly int Length => 283; + private T _element; + } + + [InlineArray(284)] + public struct Array284 + { + public readonly int Length => 284; + private T _element; + } + + [InlineArray(285)] + public struct Array285 + { + public readonly int Length => 285; + private T _element; + } + + [InlineArray(286)] + public struct Array286 + { + public readonly int Length => 286; + private T _element; + } + + [InlineArray(287)] + public struct Array287 + { + public readonly int Length => 287; + private T _element; + } + + [InlineArray(288)] + public struct Array288 + { + public readonly int Length => 288; + private T _element; + } + + [InlineArray(289)] + public struct Array289 + { + public readonly int Length => 289; + private T _element; + } + + [InlineArray(290)] + public struct Array290 + { + public readonly int Length => 290; + private T _element; + } + + [InlineArray(291)] + public struct Array291 + { + public readonly int Length => 291; + private T _element; + } + + [InlineArray(292)] + public struct Array292 + { + public readonly int Length => 292; + private T _element; + } + + [InlineArray(293)] + public struct Array293 + { + public readonly int Length => 293; + private T _element; + } + + [InlineArray(294)] + public struct Array294 + { + public readonly int Length => 294; + private T _element; + } + + [InlineArray(295)] + public struct Array295 + { + public readonly int Length => 295; + private T _element; + } + + [InlineArray(296)] + public struct Array296 + { + public readonly int Length => 296; + private T _element; + } + + [InlineArray(297)] + public struct Array297 + { + public readonly int Length => 297; + private T _element; + } + + [InlineArray(298)] + public struct Array298 + { + public readonly int Length => 298; + private T _element; + } + + [InlineArray(299)] + public struct Array299 + { + public readonly int Length => 299; + private T _element; + } + + [InlineArray(300)] + public struct Array300 + { + public readonly int Length => 300; + private T _element; + } + + [InlineArray(301)] + public struct Array301 + { + public readonly int Length => 301; + private T _element; + } + + [InlineArray(302)] + public struct Array302 + { + public readonly int Length => 302; + private T _element; + } + + [InlineArray(303)] + public struct Array303 + { + public readonly int Length => 303; + private T _element; + } + + [InlineArray(304)] + public struct Array304 + { + public readonly int Length => 304; + private T _element; + } + + [InlineArray(305)] + public struct Array305 + { + public readonly int Length => 305; + private T _element; + } + + [InlineArray(306)] + public struct Array306 + { + public readonly int Length => 306; + private T _element; + } + + [InlineArray(307)] + public struct Array307 + { + public readonly int Length => 307; + private T _element; + } + + [InlineArray(308)] + public struct Array308 + { + public readonly int Length => 308; + private T _element; + } + + [InlineArray(309)] + public struct Array309 + { + public readonly int Length => 309; + private T _element; + } + + [InlineArray(310)] + public struct Array310 + { + public readonly int Length => 310; + private T _element; + } + + [InlineArray(311)] + public struct Array311 + { + public readonly int Length => 311; + private T _element; + } + + [InlineArray(312)] + public struct Array312 + { + public readonly int Length => 312; + private T _element; + } + + [InlineArray(313)] + public struct Array313 + { + public readonly int Length => 313; + private T _element; + } + + [InlineArray(314)] + public struct Array314 + { + public readonly int Length => 314; + private T _element; + } + + [InlineArray(315)] + public struct Array315 + { + public readonly int Length => 315; + private T _element; + } + + [InlineArray(316)] + public struct Array316 + { + public readonly int Length => 316; + private T _element; + } + + [InlineArray(317)] + public struct Array317 + { + public readonly int Length => 317; + private T _element; + } + + [InlineArray(318)] + public struct Array318 + { + public readonly int Length => 318; + private T _element; + } + + [InlineArray(319)] + public struct Array319 + { + public readonly int Length => 319; + private T _element; + } + + [InlineArray(320)] + public struct Array320 + { + public readonly int Length => 320; + private T _element; + } + + [InlineArray(321)] + public struct Array321 + { + public readonly int Length => 321; + private T _element; + } + + [InlineArray(322)] + public struct Array322 + { + public readonly int Length => 322; + private T _element; + } + + [InlineArray(323)] + public struct Array323 + { + public readonly int Length => 323; + private T _element; + } + + [InlineArray(324)] + public struct Array324 + { + public readonly int Length => 324; + private T _element; + } + + [InlineArray(325)] + public struct Array325 + { + public readonly int Length => 325; + private T _element; + } + + [InlineArray(326)] + public struct Array326 + { + public readonly int Length => 326; + private T _element; + } + + [InlineArray(327)] + public struct Array327 + { + public readonly int Length => 327; + private T _element; + } + + [InlineArray(328)] + public struct Array328 + { + public readonly int Length => 328; + private T _element; + } + + [InlineArray(329)] + public struct Array329 + { + public readonly int Length => 329; + private T _element; + } + + [InlineArray(330)] + public struct Array330 + { + public readonly int Length => 330; + private T _element; + } + + [InlineArray(331)] + public struct Array331 + { + public readonly int Length => 331; + private T _element; + } + + [InlineArray(332)] + public struct Array332 + { + public readonly int Length => 332; + private T _element; + } + + [InlineArray(333)] + public struct Array333 + { + public readonly int Length => 333; + private T _element; + } + + [InlineArray(334)] + public struct Array334 + { + public readonly int Length => 334; + private T _element; + } + + [InlineArray(335)] + public struct Array335 + { + public readonly int Length => 335; + private T _element; + } + + [InlineArray(336)] + public struct Array336 + { + public readonly int Length => 336; + private T _element; + } + + [InlineArray(337)] + public struct Array337 + { + public readonly int Length => 337; + private T _element; + } + + [InlineArray(338)] + public struct Array338 + { + public readonly int Length => 338; + private T _element; + } + + [InlineArray(339)] + public struct Array339 + { + public readonly int Length => 339; + private T _element; + } + + [InlineArray(340)] + public struct Array340 + { + public readonly int Length => 340; + private T _element; + } + + [InlineArray(341)] + public struct Array341 + { + public readonly int Length => 341; + private T _element; + } + + [InlineArray(342)] + public struct Array342 + { + public readonly int Length => 342; + private T _element; + } + + [InlineArray(343)] + public struct Array343 + { + public readonly int Length => 343; + private T _element; + } + + [InlineArray(344)] + public struct Array344 + { + public readonly int Length => 344; + private T _element; + } + + [InlineArray(345)] + public struct Array345 + { + public readonly int Length => 345; + private T _element; + } + + [InlineArray(346)] + public struct Array346 + { + public readonly int Length => 346; + private T _element; + } + + [InlineArray(347)] + public struct Array347 + { + public readonly int Length => 347; + private T _element; + } + + [InlineArray(348)] + public struct Array348 + { + public readonly int Length => 348; + private T _element; + } + + [InlineArray(349)] + public struct Array349 + { + public readonly int Length => 349; + private T _element; + } + + [InlineArray(350)] + public struct Array350 + { + public readonly int Length => 350; + private T _element; + } + + [InlineArray(351)] + public struct Array351 + { + public readonly int Length => 351; + private T _element; + } + + [InlineArray(352)] + public struct Array352 + { + public readonly int Length => 352; + private T _element; + } + + [InlineArray(353)] + public struct Array353 + { + public readonly int Length => 353; + private T _element; + } + + [InlineArray(354)] + public struct Array354 + { + public readonly int Length => 354; + private T _element; + } + + [InlineArray(355)] + public struct Array355 + { + public readonly int Length => 355; + private T _element; + } + + [InlineArray(356)] + public struct Array356 + { + public readonly int Length => 356; + private T _element; + } + + [InlineArray(357)] + public struct Array357 + { + public readonly int Length => 357; + private T _element; + } + + [InlineArray(358)] + public struct Array358 + { + public readonly int Length => 358; + private T _element; + } + + [InlineArray(359)] + public struct Array359 + { + public readonly int Length => 359; + private T _element; + } + + [InlineArray(360)] + public struct Array360 + { + public readonly int Length => 360; + private T _element; + } + + [InlineArray(361)] + public struct Array361 + { + public readonly int Length => 361; + private T _element; + } + + [InlineArray(362)] + public struct Array362 + { + public readonly int Length => 362; + private T _element; + } + + [InlineArray(363)] + public struct Array363 + { + public readonly int Length => 363; + private T _element; + } + + [InlineArray(364)] + public struct Array364 + { + public readonly int Length => 364; + private T _element; + } + + [InlineArray(365)] + public struct Array365 + { + public readonly int Length => 365; + private T _element; + } + + [InlineArray(366)] + public struct Array366 + { + public readonly int Length => 366; + private T _element; + } + + [InlineArray(367)] + public struct Array367 + { + public readonly int Length => 367; + private T _element; + } + + [InlineArray(368)] + public struct Array368 + { + public readonly int Length => 368; + private T _element; + } + + [InlineArray(369)] + public struct Array369 + { + public readonly int Length => 369; + private T _element; + } + + [InlineArray(370)] + public struct Array370 + { + public readonly int Length => 370; + private T _element; + } + + [InlineArray(371)] + public struct Array371 + { + public readonly int Length => 371; + private T _element; + } + + [InlineArray(372)] + public struct Array372 + { + public readonly int Length => 372; + private T _element; + } + + [InlineArray(373)] + public struct Array373 + { + public readonly int Length => 373; + private T _element; + } + + [InlineArray(374)] + public struct Array374 + { + public readonly int Length => 374; + private T _element; + } + + [InlineArray(375)] + public struct Array375 + { + public readonly int Length => 375; + private T _element; + } + + [InlineArray(376)] + public struct Array376 + { + public readonly int Length => 376; + private T _element; + } + + [InlineArray(377)] + public struct Array377 + { + public readonly int Length => 377; + private T _element; + } + + [InlineArray(378)] + public struct Array378 + { + public readonly int Length => 378; + private T _element; + } + + [InlineArray(379)] + public struct Array379 + { + public readonly int Length => 379; + private T _element; + } + + [InlineArray(380)] + public struct Array380 + { + public readonly int Length => 380; + private T _element; + } + + [InlineArray(381)] + public struct Array381 + { + public readonly int Length => 381; + private T _element; + } + + [InlineArray(382)] + public struct Array382 + { + public readonly int Length => 382; + private T _element; + } + + [InlineArray(383)] + public struct Array383 + { + public readonly int Length => 383; + private T _element; + } + + [InlineArray(384)] + public struct Array384 + { + public readonly int Length => 384; + private T _element; + } + + [InlineArray(385)] + public struct Array385 + { + public readonly int Length => 385; + private T _element; + } + + [InlineArray(386)] + public struct Array386 + { + public readonly int Length => 386; + private T _element; + } + + [InlineArray(387)] + public struct Array387 + { + public readonly int Length => 387; + private T _element; + } + + [InlineArray(388)] + public struct Array388 + { + public readonly int Length => 388; + private T _element; + } + + [InlineArray(389)] + public struct Array389 + { + public readonly int Length => 389; + private T _element; + } + + [InlineArray(390)] + public struct Array390 + { + public readonly int Length => 390; + private T _element; + } + + [InlineArray(391)] + public struct Array391 + { + public readonly int Length => 391; + private T _element; + } + + [InlineArray(392)] + public struct Array392 + { + public readonly int Length => 392; + private T _element; + } + + [InlineArray(393)] + public struct Array393 + { + public readonly int Length => 393; + private T _element; + } + + [InlineArray(394)] + public struct Array394 + { + public readonly int Length => 394; + private T _element; + } + + [InlineArray(395)] + public struct Array395 + { + public readonly int Length => 395; + private T _element; + } + + [InlineArray(396)] + public struct Array396 + { + public readonly int Length => 396; + private T _element; + } + + [InlineArray(397)] + public struct Array397 + { + public readonly int Length => 397; + private T _element; + } + + [InlineArray(398)] + public struct Array398 + { + public readonly int Length => 398; + private T _element; + } + + [InlineArray(399)] + public struct Array399 + { + public readonly int Length => 399; + private T _element; + } + + [InlineArray(400)] + public struct Array400 + { + public readonly int Length => 400; + private T _element; + } + + [InlineArray(401)] + public struct Array401 + { + public readonly int Length => 401; + private T _element; + } + + [InlineArray(402)] + public struct Array402 + { + public readonly int Length => 402; + private T _element; + } + + [InlineArray(403)] + public struct Array403 + { + public readonly int Length => 403; + private T _element; + } + + [InlineArray(404)] + public struct Array404 + { + public readonly int Length => 404; + private T _element; + } + + [InlineArray(405)] + public struct Array405 + { + public readonly int Length => 405; + private T _element; + } + + [InlineArray(406)] + public struct Array406 + { + public readonly int Length => 406; + private T _element; + } + + [InlineArray(407)] + public struct Array407 + { + public readonly int Length => 407; + private T _element; + } + + [InlineArray(408)] + public struct Array408 + { + public readonly int Length => 408; + private T _element; + } + + [InlineArray(409)] + public struct Array409 + { + public readonly int Length => 409; + private T _element; + } + + [InlineArray(410)] + public struct Array410 + { + public readonly int Length => 410; + private T _element; + } + + [InlineArray(411)] + public struct Array411 + { + public readonly int Length => 411; + private T _element; + } + + [InlineArray(412)] + public struct Array412 + { + public readonly int Length => 412; + private T _element; + } + + [InlineArray(413)] + public struct Array413 + { + public readonly int Length => 413; + private T _element; + } + + [InlineArray(414)] + public struct Array414 + { + public readonly int Length => 414; + private T _element; + } + + [InlineArray(415)] + public struct Array415 + { + public readonly int Length => 415; + private T _element; + } + + [InlineArray(416)] + public struct Array416 + { + public readonly int Length => 416; + private T _element; + } + + [InlineArray(417)] + public struct Array417 + { + public readonly int Length => 417; + private T _element; + } + + [InlineArray(418)] + public struct Array418 + { + public readonly int Length => 418; + private T _element; + } + + [InlineArray(419)] + public struct Array419 + { + public readonly int Length => 419; + private T _element; + } + + [InlineArray(420)] + public struct Array420 + { + public readonly int Length => 420; + private T _element; + } + + [InlineArray(421)] + public struct Array421 + { + public readonly int Length => 421; + private T _element; + } + + [InlineArray(422)] + public struct Array422 + { + public readonly int Length => 422; + private T _element; + } + + [InlineArray(423)] + public struct Array423 + { + public readonly int Length => 423; + private T _element; + } + + [InlineArray(424)] + public struct Array424 + { + public readonly int Length => 424; + private T _element; + } + + [InlineArray(425)] + public struct Array425 + { + public readonly int Length => 425; + private T _element; + } + + [InlineArray(426)] + public struct Array426 + { + public readonly int Length => 426; + private T _element; + } + + [InlineArray(427)] + public struct Array427 + { + public readonly int Length => 427; + private T _element; + } + + [InlineArray(428)] + public struct Array428 + { + public readonly int Length => 428; + private T _element; + } + + [InlineArray(429)] + public struct Array429 + { + public readonly int Length => 429; + private T _element; + } + + [InlineArray(430)] + public struct Array430 + { + public readonly int Length => 430; + private T _element; + } + + [InlineArray(431)] + public struct Array431 + { + public readonly int Length => 431; + private T _element; + } + + [InlineArray(432)] + public struct Array432 + { + public readonly int Length => 432; + private T _element; + } + + [InlineArray(433)] + public struct Array433 + { + public readonly int Length => 433; + private T _element; + } + + [InlineArray(434)] + public struct Array434 + { + public readonly int Length => 434; + private T _element; + } + + [InlineArray(435)] + public struct Array435 + { + public readonly int Length => 435; + private T _element; + } + + [InlineArray(436)] + public struct Array436 + { + public readonly int Length => 436; + private T _element; + } + + [InlineArray(437)] + public struct Array437 + { + public readonly int Length => 437; + private T _element; + } + + [InlineArray(438)] + public struct Array438 + { + public readonly int Length => 438; + private T _element; + } + + [InlineArray(439)] + public struct Array439 + { + public readonly int Length => 439; + private T _element; + } + + [InlineArray(440)] + public struct Array440 + { + public readonly int Length => 440; + private T _element; + } + + [InlineArray(441)] + public struct Array441 + { + public readonly int Length => 441; + private T _element; + } + + [InlineArray(442)] + public struct Array442 + { + public readonly int Length => 442; + private T _element; + } + + [InlineArray(443)] + public struct Array443 + { + public readonly int Length => 443; + private T _element; + } + + [InlineArray(444)] + public struct Array444 + { + public readonly int Length => 444; + private T _element; + } + + [InlineArray(445)] + public struct Array445 + { + public readonly int Length => 445; + private T _element; + } + + [InlineArray(446)] + public struct Array446 + { + public readonly int Length => 446; + private T _element; + } + + [InlineArray(447)] + public struct Array447 + { + public readonly int Length => 447; + private T _element; + } + + [InlineArray(448)] + public struct Array448 + { + public readonly int Length => 448; + private T _element; + } + + [InlineArray(449)] + public struct Array449 + { + public readonly int Length => 449; + private T _element; + } + + [InlineArray(450)] + public struct Array450 + { + public readonly int Length => 450; + private T _element; + } + + [InlineArray(451)] + public struct Array451 + { + public readonly int Length => 451; + private T _element; + } + + [InlineArray(452)] + public struct Array452 + { + public readonly int Length => 452; + private T _element; + } + + [InlineArray(453)] + public struct Array453 + { + public readonly int Length => 453; + private T _element; + } + + [InlineArray(454)] + public struct Array454 + { + public readonly int Length => 454; + private T _element; + } + + [InlineArray(455)] + public struct Array455 + { + public readonly int Length => 455; + private T _element; + } + + [InlineArray(456)] + public struct Array456 + { + public readonly int Length => 456; + private T _element; + } + + [InlineArray(457)] + public struct Array457 + { + public readonly int Length => 457; + private T _element; + } + + [InlineArray(458)] + public struct Array458 + { + public readonly int Length => 458; + private T _element; + } + + [InlineArray(459)] + public struct Array459 + { + public readonly int Length => 459; + private T _element; + } + + [InlineArray(460)] + public struct Array460 + { + public readonly int Length => 460; + private T _element; + } + + [InlineArray(461)] + public struct Array461 + { + public readonly int Length => 461; + private T _element; + } + + [InlineArray(462)] + public struct Array462 + { + public readonly int Length => 462; + private T _element; + } + + [InlineArray(463)] + public struct Array463 + { + public readonly int Length => 463; + private T _element; + } + + [InlineArray(464)] + public struct Array464 + { + public readonly int Length => 464; + private T _element; + } + + [InlineArray(465)] + public struct Array465 + { + public readonly int Length => 465; + private T _element; + } + + [InlineArray(466)] + public struct Array466 + { + public readonly int Length => 466; + private T _element; + } + + [InlineArray(467)] + public struct Array467 + { + public readonly int Length => 467; + private T _element; + } + + [InlineArray(468)] + public struct Array468 + { + public readonly int Length => 468; + private T _element; + } + + [InlineArray(469)] + public struct Array469 + { + public readonly int Length => 469; + private T _element; + } + + [InlineArray(470)] + public struct Array470 + { + public readonly int Length => 470; + private T _element; + } + + [InlineArray(471)] + public struct Array471 + { + public readonly int Length => 471; + private T _element; + } + + [InlineArray(472)] + public struct Array472 + { + public readonly int Length => 472; + private T _element; + } + + [InlineArray(473)] + public struct Array473 + { + public readonly int Length => 473; + private T _element; + } + + [InlineArray(474)] + public struct Array474 + { + public readonly int Length => 474; + private T _element; + } + + [InlineArray(475)] + public struct Array475 + { + public readonly int Length => 475; + private T _element; + } + + [InlineArray(476)] + public struct Array476 + { + public readonly int Length => 476; + private T _element; + } + + [InlineArray(477)] + public struct Array477 + { + public readonly int Length => 477; + private T _element; + } + + [InlineArray(478)] + public struct Array478 + { + public readonly int Length => 478; + private T _element; + } + + [InlineArray(479)] + public struct Array479 + { + public readonly int Length => 479; + private T _element; + } + + [InlineArray(480)] + public struct Array480 + { + public readonly int Length => 480; + private T _element; + } + + [InlineArray(481)] + public struct Array481 + { + public readonly int Length => 481; + private T _element; + } + + [InlineArray(482)] + public struct Array482 + { + public readonly int Length => 482; + private T _element; + } + + [InlineArray(483)] + public struct Array483 + { + public readonly int Length => 483; + private T _element; + } + + [InlineArray(484)] + public struct Array484 + { + public readonly int Length => 484; + private T _element; + } + + [InlineArray(485)] + public struct Array485 + { + public readonly int Length => 485; + private T _element; + } + + [InlineArray(486)] + public struct Array486 + { + public readonly int Length => 486; + private T _element; + } + + [InlineArray(487)] + public struct Array487 + { + public readonly int Length => 487; + private T _element; + } + + [InlineArray(488)] + public struct Array488 + { + public readonly int Length => 488; + private T _element; + } + + [InlineArray(489)] + public struct Array489 + { + public readonly int Length => 489; + private T _element; + } + + [InlineArray(490)] + public struct Array490 + { + public readonly int Length => 490; + private T _element; + } + + [InlineArray(491)] + public struct Array491 + { + public readonly int Length => 491; + private T _element; + } + + [InlineArray(492)] + public struct Array492 + { + public readonly int Length => 492; + private T _element; + } + + [InlineArray(493)] + public struct Array493 + { + public readonly int Length => 493; + private T _element; + } + + [InlineArray(494)] + public struct Array494 + { + public readonly int Length => 494; + private T _element; + } + + [InlineArray(495)] + public struct Array495 + { + public readonly int Length => 495; + private T _element; + } + + [InlineArray(496)] + public struct Array496 + { + public readonly int Length => 496; + private T _element; + } + + [InlineArray(497)] + public struct Array497 + { + public readonly int Length => 497; + private T _element; + } + + [InlineArray(498)] + public struct Array498 + { + public readonly int Length => 498; + private T _element; + } + + [InlineArray(499)] + public struct Array499 + { + public readonly int Length => 499; + private T _element; + } + + [InlineArray(500)] + public struct Array500 + { + public readonly int Length => 500; + private T _element; + } + + [InlineArray(501)] + public struct Array501 + { + public readonly int Length => 501; + private T _element; + } + + [InlineArray(502)] + public struct Array502 + { + public readonly int Length => 502; + private T _element; + } + + [InlineArray(503)] + public struct Array503 + { + public readonly int Length => 503; + private T _element; + } + + [InlineArray(504)] + public struct Array504 + { + public readonly int Length => 504; + private T _element; + } + + [InlineArray(505)] + public struct Array505 + { + public readonly int Length => 505; + private T _element; + } + + [InlineArray(506)] + public struct Array506 + { + public readonly int Length => 506; + private T _element; + } + + [InlineArray(507)] + public struct Array507 + { + public readonly int Length => 507; + private T _element; + } + + [InlineArray(508)] + public struct Array508 + { + public readonly int Length => 508; + private T _element; + } + + [InlineArray(509)] + public struct Array509 + { + public readonly int Length => 509; + private T _element; + } + + [InlineArray(510)] + public struct Array510 + { + public readonly int Length => 510; + private T _element; + } + + [InlineArray(511)] + public struct Array511 + { + public readonly int Length => 511; + private T _element; + } + + [InlineArray(512)] + public struct Array512 + { + public readonly int Length => 512; + private T _element; + } + + [InlineArray(1024)] + public struct Array1024 + { + public readonly int Length => 1024; + private T _element; + } + + [InlineArray(2048)] + public struct Array2048 + { + public readonly int Length => 2048; + private T _element; + } + + [InlineArray(4096)] + public struct Array4096 + { + public readonly int Length => 4096; + private T _element; + } +} \ No newline at end of file diff --git a/src/Ryujinx.Graphics.Device/SizeCalculator.cs b/src/Ryujinx.Graphics.Device/SizeCalculator.cs index d5697fe5e..bfe2e9d1a 100644 --- a/src/Ryujinx.Graphics.Device/SizeCalculator.cs +++ b/src/Ryujinx.Graphics.Device/SizeCalculator.cs @@ -1,5 +1,6 @@ using System; using System.Reflection; +using System.Runtime.CompilerServices; namespace Ryujinx.Graphics.Device { @@ -28,6 +29,14 @@ namespace Ryujinx.Graphics.Device return type.StructLayoutAttribute.Size; } + // If the struct has the InlineArray attribute, the size is specified on the attribute, and the first field has the type. + if (type.GetCustomAttribute() is InlineArrayAttribute attribute) + { + Type field0Type = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)[0].FieldType; + + return attribute.Length * SizeOf(field0Type); + } + // Otherwise we calculate the sum of the sizes of all fields. int size = 0; var fields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs index 6dbe4b7be..c1377982d 100644 --- a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs +++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs @@ -13,13 +13,13 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands public void Set(int vertices, ReadOnlySpan defaultOuterLevel, ReadOnlySpan defaultInnerLevel) { _vertices = vertices; - defaultOuterLevel.CopyTo(_defaultOuterLevel.AsSpan()); - defaultInnerLevel.CopyTo(_defaultInnerLevel.AsSpan()); + defaultOuterLevel.CopyTo(_defaultOuterLevel); + defaultInnerLevel.CopyTo(_defaultInnerLevel); } public static void Run(ref SetPatchParametersCommand command, ThreadedRenderer threaded, IRenderer renderer) { - renderer.Pipeline.SetPatchParameters(command._vertices, command._defaultOuterLevel.AsSpan(), command._defaultInnerLevel.AsSpan()); + renderer.Pipeline.SetPatchParameters(command._vertices, command._defaultOuterLevel, command._defaultInnerLevel); } } } diff --git a/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs b/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs index 96fd667ad..5cd318468 100644 --- a/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs +++ b/src/Ryujinx.Graphics.GAL/ProgramPipelineState.cs @@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.GAL public void SetVertexAttribs(ReadOnlySpan vertexAttribs) { VertexAttribCount = vertexAttribs.Length; - vertexAttribs.CopyTo(VertexAttribs.AsSpan()); + vertexAttribs.CopyTo(VertexAttribs); } public void SetLogicOpState(bool enable, LogicalOp op) diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs index 1ff821569..a1e8f3dd8 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs @@ -392,8 +392,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed _context.Renderer.Pipeline.SetPatchParameters( _state.State.PatchVertices, - _state.State.TessOuterLevel.AsSpan(), - _state.State.TessInnerLevel.AsSpan()); + _state.State.TessOuterLevel, + _state.State.TessInnerLevel); _currentSpecState.SetTessellationMode(_state.State.TessMode); } diff --git a/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs b/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs index fb141db42..84864bb72 100644 --- a/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs +++ b/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs @@ -20,7 +20,7 @@ namespace Ryujinx.Graphics.Gpu.Memory public SupportBufferUpdater(IRenderer renderer) : base(renderer) { var defaultScale = new Vector4 { X = 1f, Y = 0f, Z = 0f, W = 0f }; - _data.RenderScale.AsSpan().Fill(defaultScale); + ((Span>)_data.RenderScale).Fill(defaultScale); DirtyRenderScale(0, SupportBuffer.RenderScaleMaxCount); } diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs index de6432bc1..2943a3cc5 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs @@ -139,7 +139,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache /// public ReadOnlySpan QueryTransformFeedbackVaryingLocations(int bufferIndex) { - return _oldSpecState.TransformFeedbackDescriptors[bufferIndex].AsSpan(); + return MemoryMarshal.Cast(_oldSpecState.TransformFeedbackDescriptors[bufferIndex].VaryingLocations); } /// diff --git a/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs b/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs index 1d84d0e46..3367166f9 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs @@ -179,7 +179,7 @@ namespace Ryujinx.Graphics.Gpu.Shader /// public ReadOnlySpan QueryTransformFeedbackVaryingLocations(int bufferIndex) { - return _state.TransformFeedbackDescriptors[bufferIndex].AsSpan(); + return MemoryMarshal.Cast(_state.TransformFeedbackDescriptors[bufferIndex].VaryingLocations); } /// diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs index a41f761bd..0a4ac9676 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs @@ -514,7 +514,7 @@ namespace Ryujinx.Graphics.Gpu.Shader } else { - if (!graphicsState.AttributeTypes.AsSpan().SequenceEqual(GraphicsState.AttributeTypes.AsSpan())) + if (!((Span)graphicsState.AttributeTypes).SequenceEqual(GraphicsState.AttributeTypes)) { return false; } @@ -530,7 +530,8 @@ namespace Ryujinx.Graphics.Gpu.Shader return false; } - if (channel.Capabilities.NeedsFragmentOutputSpecialization && !graphicsState.FragmentOutputTypes.AsSpan().SequenceEqual(GraphicsState.FragmentOutputTypes.AsSpan())) + if (channel.Capabilities.NeedsFragmentOutputSpecialization && + !((Span)graphicsState.FragmentOutputTypes).SequenceEqual(GraphicsState.FragmentOutputTypes)) { return false; } diff --git a/src/Ryujinx.Graphics.Gpu/Shader/TransformFeedbackDescriptor.cs b/src/Ryujinx.Graphics.Gpu/Shader/TransformFeedbackDescriptor.cs index 1f245881d..ae5ab0d16 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/TransformFeedbackDescriptor.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/TransformFeedbackDescriptor.cs @@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.Gpu.Shader /// /// Location of varyings to be written into the buffer. Each byte is one location. /// - public Array32 VaryingLocations; // Making this readonly breaks AsSpan + public Array32 VaryingLocations; /// /// Creates a new transform feedback descriptor. @@ -45,14 +45,5 @@ namespace Ryujinx.Graphics.Gpu.Shader VaryingCount = varyingCount; VaryingLocations = varyingLocations; } - - /// - /// Gets a span of the . - /// - /// Span of varying locations - public ReadOnlySpan AsSpan() - { - return MemoryMarshal.Cast(VaryingLocations.AsSpan())[..Math.Min(128, VaryingCount)]; - } } } diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs index 82c5932b7..944211798 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs @@ -138,7 +138,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264 3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4, }; - private static void WriteScalingList(ref H264BitStreamWriter writer, IArray list) + private static void WriteScalingList(ref H264BitStreamWriter writer, Span list) { ReadOnlySpan scan = list.Length == 16 ? ZigZagScan : ZigZagDirect; diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/DecodeFrame.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/DecodeFrame.cs index 6940d187f..2dbd34604 100644 --- a/src/Ryujinx.Graphics.Nvdec.Vp9/DecodeFrame.cs +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/DecodeFrame.cs @@ -1295,12 +1295,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 GetTileBuffers(ref cm, data, tileCols, ref tileBuffers); - tileBuffers.AsSpan()[..tileCols].Sort(CompareTileBuffers); + tileBuffers[..tileCols].Sort(CompareTileBuffers); if (numWorkers == tileCols) { TileBuffer largest = tileBuffers[0]; - Span buffers = tileBuffers.AsSpan(); + Span buffers = tileBuffers; buffers[1..].CopyTo(buffers[..(tileBuffers.Length - 1)]); tileBuffers[tileCols - 1] = largest; } diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/DecodeMv.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/DecodeMv.cs index 8c25c700b..b1a07c774 100644 --- a/src/Ryujinx.Graphics.Nvdec.Vp9/DecodeMv.cs +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/DecodeMv.cs @@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 private static PredictionMode ReadIntraModeY(ref Vp9Common cm, ref MacroBlockD xd, ref Reader r, int sizeGroup) { - PredictionMode yMode = ReadIntraMode(ref r, cm.Fc.Value.YModeProb[sizeGroup].AsSpan()); + PredictionMode yMode = ReadIntraMode(ref r, cm.Fc.Value.YModeProb[sizeGroup]); if (!xd.Counts.IsNull) { ++xd.Counts.Value.YMode[sizeGroup][(int)yMode]; @@ -30,7 +30,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 private static PredictionMode ReadIntraModeUv(ref Vp9Common cm, ref MacroBlockD xd, ref Reader r, byte yMode) { - PredictionMode uvMode = ReadIntraMode(ref r, cm.Fc.Value.UvModeProb[yMode].AsSpan()); + PredictionMode uvMode = ReadIntraMode(ref r, cm.Fc.Value.UvModeProb[yMode]); if (!xd.Counts.IsNull) { ++xd.Counts.Value.UvMode[yMode][(int)uvMode]; @@ -41,7 +41,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 private static PredictionMode ReadInterMode(ref Vp9Common cm, ref MacroBlockD xd, ref Reader r, int ctx) { - int mode = r.ReadTree(Luts.Vp9InterModeTree, cm.Fc.Value.InterModeProb[ctx].AsSpan()); + int mode = r.ReadTree(Luts.Vp9InterModeTree, cm.Fc.Value.InterModeProb[ctx]); if (!xd.Counts.IsNull) { ++xd.Counts.Value.InterMode[ctx][mode]; @@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 private static int ReadSegmentId(ref Reader r, ref Array7 segTreeProbs) { - return r.ReadTree(Luts.Vp9SegmentTree, segTreeProbs.AsSpan()); + return r.ReadTree(Luts.Vp9SegmentTree, segTreeProbs); } private static ReadOnlySpan GetTxProbs(ref Vp9EntropyProbs fc, TxSize maxTxSize, int ctx) @@ -60,11 +60,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 switch (maxTxSize) { case TxSize.Tx8x8: - return fc.Tx8x8Prob[ctx].AsSpan(); + return fc.Tx8x8Prob[ctx]; case TxSize.Tx16x16: - return fc.Tx16x16Prob[ctx].AsSpan(); + return fc.Tx16x16Prob[ctx]; case TxSize.Tx32x32: - return fc.Tx32x32Prob[ctx].AsSpan(); + return fc.Tx32x32Prob[ctx]; default: Debug.Assert(false, "Invalid maxTxSize."); @@ -77,11 +77,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 switch (maxTxSize) { case TxSize.Tx8x8: - return counts.Tx8x8[ctx].AsSpan(); + return counts.Tx8x8[ctx]; case TxSize.Tx16x16: - return counts.Tx16x16[ctx].AsSpan(); + return counts.Tx16x16[ctx]; case TxSize.Tx32x32: - return counts.Tx32x32[ctx].AsSpan(); + return counts.Tx32x32[ctx]; default: Debug.Assert(false, "Invalid maxTxSize."); @@ -264,7 +264,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 { int mag, d, fr, hp; bool sign = r.Read(fc.Sign[mvcomp]) != 0; - MvClassType mvClass = (MvClassType)r.ReadTree(Luts.Vp9MvClassTree, fc.Classes[mvcomp].AsSpan()); + MvClassType mvClass = (MvClassType)r.ReadTree(Luts.Vp9MvClassTree, fc.Classes[mvcomp]); bool class0 = mvClass == MvClassType.MvClass0; // Integer part @@ -288,7 +288,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 } // Fractional part - fr = r.ReadTree(Luts.Vp9MvFPTree, class0 ? fc.Class0Fp[mvcomp][d].AsSpan() : fc.Fp[mvcomp].AsSpan()); + fr = r.ReadTree(Luts.Vp9MvFPTree, class0 ? (Span)fc.Class0Fp[mvcomp][d] : (Span)fc.Fp[mvcomp]); // High precision part (if hp is not used, the default value of the hp is 1) hp = usehp ? r.Read(class0 ? fc.Class0Hp[mvcomp] : fc.Hp[mvcomp]) : 1; @@ -307,7 +307,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 Ptr counts, bool allowHP) { - MvJointType jointType = (MvJointType)r.ReadTree(Luts.Vp9MvJointTree, fc.Joints.AsSpan()); + MvJointType jointType = (MvJointType)r.ReadTree(Luts.Vp9MvJointTree, fc.Joints); bool useHP = allowHP && refr.UseMvHp(); Mv diff = new(); @@ -412,7 +412,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 private static byte ReadSwitchableInterpFilter(ref Vp9Common cm, ref MacroBlockD xd, ref Reader r) { int ctx = xd.GetPredContextSwitchableInterp(); - byte type = (byte)r.ReadTree(Luts.Vp9SwitchableInterpTree, cm.Fc.Value.SwitchableInterpProb[ctx].AsSpan()); + byte type = (byte)r.ReadTree(Luts.Vp9SwitchableInterpTree, cm.Fc.Value.SwitchableInterpProb[ctx]); if (!xd.Counts.IsNull) { ++xd.Counts.Value.SwitchableInterp[ctx][type]; @@ -1076,7 +1076,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 PredictionMode above = AboveBlockMode(mi, aboveMi, block); PredictionMode left = LeftBlockMode(mi, leftMi, block); - return fc.KfYModeProb[(int)above][(int)left].AsSpan(); + return fc.KfYModeProb[(int)above][(int)left]; } private static void ReadIntraFrameModeInfo( @@ -1129,7 +1129,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 break; } - mi.Value.UvMode = ReadIntraMode(ref r, cm.Fc.Value.KfUvModeProb[(int)mi.Value.Mode].AsSpan()); + mi.Value.UvMode = ReadIntraMode(ref r, cm.Fc.Value.KfUvModeProb[(int)mi.Value.Mode]); } private static void CopyRefFramePair(ref Array2 dst, ref Array2 src) diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/LoopFilter.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/LoopFilter.cs index 1c9f83b49..110cadc88 100644 --- a/src/Ryujinx.Graphics.Nvdec.Vp9/LoopFilter.cs +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/LoopFilter.cs @@ -349,8 +349,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 blockInsideLimit = 1; } - lfi.Lfthr[lvl].Lim.AsSpan().Fill((byte)blockInsideLimit); - lfi.Lfthr[lvl].Mblim.AsSpan().Fill((byte)(2 * (lvl + 2) + blockInsideLimit)); + ((Span)lfi.Lfthr[lvl].Lim).Fill((byte)blockInsideLimit); + ((Span)lfi.Lfthr[lvl].Mblim).Fill((byte)(2 * (lvl + 2) + blockInsideLimit)); } } @@ -385,7 +385,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 { // We could get rid of this if we assume that deltas are set to // zero when not in use; encoder always uses deltas - MemoryMarshal.Cast, byte>(lfi.Lvl[segId].AsSpan()).Fill((byte)lvlSeg); + MemoryMarshal.Cast, byte>(lfi.Lvl[segId]).Fill((byte)lvlSeg); } else { diff --git a/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs b/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs index 5175d911a..cc8f7e653 100644 --- a/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs +++ b/src/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs @@ -333,7 +333,7 @@ namespace Ryujinx.Graphics.Vic.Image bool isField = frameFormat.IsField(); bool isTopField = frameFormat.IsTopField(isLuma); int stride = GetPitch(width, bytesPerPixel); - uint offset = GetOffset(ref offsets[0], plane); + uint offset = GetOffset(offsets[0], plane); int dstStart = 0; int dstStride = stride; @@ -362,12 +362,12 @@ namespace Ryujinx.Graphics.Vic.Image if (config.PrevFieldEnable) { - prevBuffer = ReadBufferNoDeinterlace(rm, ref offsets[1], linear, plane, width, height, bytesPerPixel, gobBlocksInY); + prevBuffer = ReadBufferNoDeinterlace(rm, offsets[1], linear, plane, width, height, bytesPerPixel, gobBlocksInY); } if (config.NextFieldEnable) { - nextBuffer = ReadBufferNoDeinterlace(rm, ref offsets[2], linear, plane, width, height, bytesPerPixel, gobBlocksInY); + nextBuffer = ReadBufferNoDeinterlace(rm, offsets[2], linear, plane, width, height, bytesPerPixel, gobBlocksInY); } int w = width * bytesPerPixel; @@ -410,7 +410,7 @@ namespace Ryujinx.Graphics.Vic.Image return buffer; } - private static uint GetOffset(ref PlaneOffsets offsets, int plane) + private static uint GetOffset(PlaneOffsets offsets, int plane) { return plane switch { @@ -423,7 +423,7 @@ namespace Ryujinx.Graphics.Vic.Image private static RentedBuffer ReadBufferNoDeinterlace( ResourceManager rm, - ref PlaneOffsets offsets, + PlaneOffsets offsets, bool linear, int plane, int width, @@ -432,7 +432,7 @@ namespace Ryujinx.Graphics.Vic.Image int gobBlocksInY) { int stride = GetPitch(width, bytesPerPixel); - uint offset = GetOffset(ref offsets, plane); + uint offset = GetOffset(offsets, plane); if (linear) { diff --git a/src/Ryujinx.Graphics.Vulkan/BitMapStruct.cs b/src/Ryujinx.Graphics.Vulkan/BitMapStruct.cs index 15672e9cb..ff48c97ee 100644 --- a/src/Ryujinx.Graphics.Vulkan/BitMapStruct.cs +++ b/src/Ryujinx.Graphics.Vulkan/BitMapStruct.cs @@ -9,21 +9,21 @@ namespace Ryujinx.Graphics.Vulkan void BitMapSignal(int index, int count); } - struct BitMapStruct where T : IArray + struct BitMapStruct { public const int IntSize = 64; private const int IntShift = 6; private const int IntMask = IntSize - 1; - private T _masks; + private Array2 _masks; public BitMapStruct() { _masks = default; } - public bool BecomesUnsetFrom(in BitMapStruct from, ref BitMapStruct into) + public readonly bool BecomesUnsetFrom(in BitMapStruct from, ref BitMapStruct into) { bool result = false; @@ -40,9 +40,9 @@ namespace Ryujinx.Graphics.Vulkan return result; } - public void SetAndSignalUnset(in BitMapStruct from, ref T2 listener) where T2 : struct, IBitMapListener + public void SetAndSignalUnset(in BitMapStruct from, ref T2 listener) where T2 : struct, IBitMapListener { - BitMapStruct result = new(); + BitMapStruct result = new(); if (BecomesUnsetFrom(from, ref result)) { @@ -50,7 +50,7 @@ namespace Ryujinx.Graphics.Vulkan int offset = 0; int masks = _masks.Length; - ref T resultMasks = ref result._masks; + ref Array2 resultMasks = ref result._masks; for (int i = 0; i < masks; i++) { long value = resultMasks[i]; @@ -70,7 +70,7 @@ namespace Ryujinx.Graphics.Vulkan _masks = from._masks; } - public void SignalSet(Action action) + public readonly void SignalSet(Action action) { // Iterate the set bits in the result, and signal them. @@ -92,7 +92,7 @@ namespace Ryujinx.Graphics.Vulkan } } - public bool AnySet() + public readonly bool AnySet() { for (int i = 0; i < _masks.Length; i++) { @@ -105,7 +105,7 @@ namespace Ryujinx.Graphics.Vulkan return false; } - public bool IsSet(int bit) + public readonly bool IsSet(int bit) { int wordIndex = bit >> IntShift; int wordBit = bit & IntMask; @@ -218,9 +218,9 @@ namespace Ryujinx.Graphics.Vulkan } } - public BitMapStruct Union(BitMapStruct other) + public BitMapStruct Union(BitMapStruct other) { - var result = new BitMapStruct(); + var result = new BitMapStruct(); ref var masks = ref _masks; ref var otherMasks = ref other._masks; diff --git a/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs b/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs index a9a92df1d..c58438181 100644 --- a/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs +++ b/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs @@ -54,10 +54,10 @@ namespace Ryujinx.Graphics.Vulkan private readonly BufferView[] _bufferTextures; private readonly BufferView[] _bufferImages; - private BitMapStruct> _uniformSet; - private BitMapStruct> _storageSet; - private BitMapStruct> _uniformMirrored; - private BitMapStruct> _storageMirrored; + private BitMapStruct _uniformSet; + private BitMapStruct _storageSet; + private BitMapStruct _uniformMirrored; + private BitMapStruct _storageMirrored; private bool _updateDescriptorCacheCbIndex; diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index 7346d7891..b647b1d07 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -1462,7 +1462,7 @@ namespace Ryujinx.Graphics.Vulkan protected void UpdatePipelineAttachmentFormats() { - var dstAttachmentFormats = _newState.Internal.AttachmentFormats.AsSpan(); + var dstAttachmentFormats = _newState.Internal.AttachmentFormats; FramebufferParams.AttachmentFormats.CopyTo(dstAttachmentFormats); _newState.Internal.AttachmentIntegerFormatMask = FramebufferParams.AttachmentIntegerFormatMask; diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs b/src/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs index a5c218ac2..c8104da8f 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs @@ -136,7 +136,7 @@ namespace Ryujinx.Graphics.Vulkan private void RecordBlend(Vk api, CommandBuffer commandBuffer) { - api.CmdSetBlendConstants(commandBuffer, _blendConstants.AsSpan()); + api.CmdSetBlendConstants(commandBuffer, _blendConstants); } private readonly void RecordDepthBias(Vk api, CommandBuffer commandBuffer) @@ -148,7 +148,7 @@ namespace Ryujinx.Graphics.Vulkan { if (ScissorsCount != 0) { - api.CmdSetScissor(commandBuffer, 0, (uint)ScissorsCount, _scissors.AsSpan()); + api.CmdSetScissor(commandBuffer, 0, (uint)ScissorsCount, _scissors); } } @@ -166,7 +166,7 @@ namespace Ryujinx.Graphics.Vulkan { if (ViewportsCount != 0) { - api.CmdSetViewport(commandBuffer, 0, ViewportsCount, Viewports.AsSpan()); + api.CmdSetViewport(commandBuffer, 0, ViewportsCount, Viewports); } } } diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineUid.cs b/src/Ryujinx.Graphics.Vulkan/PipelineUid.cs index 460c27d8b..17475a368 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineUid.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineUid.cs @@ -49,22 +49,22 @@ namespace Ryujinx.Graphics.Vulkan return false; } - if (!SequenceEqual(VertexAttributeDescriptions.AsSpan(), other.VertexAttributeDescriptions.AsSpan(), VertexAttributeDescriptionsCount)) + if (!SequenceEqual(VertexAttributeDescriptions, other.VertexAttributeDescriptions, VertexAttributeDescriptionsCount)) { return false; } - if (!SequenceEqual(VertexBindingDescriptions.AsSpan(), other.VertexBindingDescriptions.AsSpan(), VertexBindingDescriptionsCount)) + if (!SequenceEqual(VertexBindingDescriptions, other.VertexBindingDescriptions, VertexBindingDescriptionsCount)) { return false; } - if (!SequenceEqual(ColorBlendAttachmentState.AsSpan(), other.ColorBlendAttachmentState.AsSpan(), ColorBlendAttachmentStateCount)) + if (!SequenceEqual(ColorBlendAttachmentState, other.ColorBlendAttachmentState, ColorBlendAttachmentStateCount)) { return false; } - if (!SequenceEqual(AttachmentFormats.AsSpan(), other.AttachmentFormats.AsSpan(), ColorBlendAttachmentStateCount + (HasDepthStencil ? 1u : 0u))) + if (!SequenceEqual(AttachmentFormats, other.AttachmentFormats, ColorBlendAttachmentStateCount + (HasDepthStencil ? 1u : 0u))) { return false; } diff --git a/src/Ryujinx.HLE/HOS/Services/Audio/IHardwareOpusDecoderManager.cs b/src/Ryujinx.HLE/HOS/Services/Audio/IHardwareOpusDecoderManager.cs index 514b51a51..44729f035 100644 --- a/src/Ryujinx.HLE/HOS/Services/Audio/IHardwareOpusDecoderManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Audio/IHardwareOpusDecoderManager.cs @@ -117,7 +117,7 @@ namespace Ryujinx.HLE.HOS.Services.Audio OpusMultiStreamParametersEx parameters = context.Memory.Read(parametersAddress); - byte[] mappings = MemoryMarshal.Cast(parameters.ChannelMappings.AsSpan()).ToArray(); + byte[] mappings = MemoryMarshal.Cast(parameters.ChannelMappings).ToArray(); // UseLargeFrameSize can be ignored due to not relying on fixed size buffers for storing the decoded result. MakeObject(context, new IHardwareOpusDecoder( diff --git a/src/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs b/src/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs index 54d23e88c..ed17753dc 100644 --- a/src/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs @@ -292,7 +292,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator Array16 randomGuid = new(); - Guid.NewGuid().ToByteArray().AsSpan().CopyTo(randomGuid.AsSpan()); + Guid.NewGuid().ToByteArray().AsSpan().CopyTo(randomGuid); PlayHistoryRegistrationKey playHistoryRegistrationKey = new() { diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/KeyboardDevice.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/KeyboardDevice.cs index 0e3630f26..325ec0761 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/KeyboardDevice.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/KeyboardDevice.cs @@ -26,7 +26,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid SamplingNumber = previousEntry.SamplingNumber + 1, }; - keyState.Keys.AsSpan().CopyTo(newState.Keys.RawData.AsSpan()); + keyState.Keys.AsSpan().CopyTo(newState.Keys.RawData); newState.Modifiers = (KeyboardModifier)keyState.Modifier; lifo.Write(ref newState); diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs index 86c6a825f..b56a19e33 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs @@ -549,7 +549,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid Attributes = SixAxisSensorAttribute.IsConnected, }; - state.Orientation.AsSpan().CopyTo(newState.Direction.AsSpan()); + state.Orientation.AsSpan().CopyTo(newState.Direction); ref RingLifo lifo = ref GetSixAxisSensorLifo(ref currentNpad, isRightPair); diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs index 26ea1cff1..263456dd7 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs @@ -1,5 +1,6 @@ using Ryujinx.Common.Memory; using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Threading; @@ -37,6 +38,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common return (index + 1) % MaxEntries; } + [UnscopedRef] public ref AtomicStorage GetCurrentAtomicEntryRef() { ulong countAvailaible = Math.Min(Math.Max(0, ReadCurrentCount()), 1); @@ -73,6 +75,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common } } + [UnscopedRef] public ref T GetCurrentEntryRef() { return ref GetCurrentAtomicEntryRef().Object; diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanDiscovery.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanDiscovery.cs index 8cfd77acb..55426cacd 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanDiscovery.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanDiscovery.cs @@ -102,7 +102,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm { Length = LdnConst.SsidLengthMax, }; - _random.NextBytes(_fakeSsid.Name.AsSpan()[..32]); + _random.NextBytes(_fakeSsid.Name[..32]); _protocol = new LanProtocol(this); _protocol.Accept += OnConnect; @@ -203,7 +203,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm return false; } - data.CopyTo(NetworkInfo.Ldn.AdvertiseData.AsSpan()); + data.CopyTo(NetworkInfo.Ldn.AdvertiseData); NetworkInfo.Ldn.AdvertiseDataSize = (ushort)data.Length; // NOTE: Otherwise this results in SessionKeepFailed or MasterDisconnected @@ -245,7 +245,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm byte[] ip = address.GetAddressBytes(); var macAddress = new Array6(); - new byte[] { 0x02, 0x00, ip[0], ip[1], ip[2], ip[3] }.CopyTo(macAddress.AsSpan()); + new byte[] { 0x02, 0x00, ip[0], ip[1], ip[2], ip[3] }.CopyTo(macAddress); return macAddress; } @@ -356,7 +356,10 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm if (filter.Flag.HasFlag(ScanFilterFlag.SessionId)) { - copy &= filter.NetworkId.SessionId.AsSpan().SequenceEqual(item.Value.NetworkId.SessionId.AsSpan()); + Array16 lSessionId = filter.NetworkId.SessionId; + Array16 rSessionId = item.Value.NetworkId.SessionId; + + copy &= ((Span)lSessionId).SequenceEqual(rSessionId); } if (filter.Flag.HasFlag(ScanFilterFlag.NetworkType)) @@ -366,8 +369,10 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm if (filter.Flag.HasFlag(ScanFilterFlag.Ssid)) { - Span gameSsid = item.Value.Common.Ssid.Name.AsSpan()[item.Value.Common.Ssid.Length..]; - Span scanSsid = filter.Ssid.Name.AsSpan()[filter.Ssid.Length..]; + Array33 ssidName = item.Value.Common.Ssid.Name; + ReadOnlySpan gameSsid = ssidName[item.Value.Common.Ssid.Length..]; + ReadOnlySpan scanSsid = filter.Ssid.Name[filter.Ssid.Length..]; + copy &= gameSsid.SequenceEqual(scanSsid); } @@ -486,7 +491,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm NetworkInfo.Common.Channel = networkConfig.Channel == 0 ? (ushort)6 : networkConfig.Channel; NetworkInfo.NetworkId.SessionId = new Array16(); - _random.NextBytes(NetworkInfo.NetworkId.SessionId.AsSpan()); + _random.NextBytes(NetworkInfo.NetworkId.SessionId); NetworkInfo.NetworkId.IntentId = networkConfig.IntentId; NetworkInfo.Ldn.Nodes[0] = GetNodeInfo(NetworkInfo.Ldn.Nodes[0], userConfig, networkConfig.LocalCommunicationVersion); diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyUdpServer.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyUdpServer.cs index b1519d1ff..5b142d593 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyUdpServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyUdpServer.cs @@ -86,7 +86,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm.Proxy { Span mac = stackalloc byte[8]; - info.Common.MacAddress.AsSpan().CopyTo(mac); + ((Span)info.Common.MacAddress).CopyTo(mac); lock (_scanLock) { diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Types/CoreData.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Types/CoreData.cs index 4f6e289e2..826839826 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Types/CoreData.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Types/CoreData.cs @@ -1,5 +1,6 @@ using Ryujinx.Common.Memory; using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using static Ryujinx.HLE.HOS.Services.Mii.Types.RandomMiiConstants; @@ -13,7 +14,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types private Array48 _storage; - public Span Storage => _storage.AsSpan(); + [UnscopedRef] + public Span Storage => _storage; [StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0x18)] public struct ElementInfo @@ -373,6 +375,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types set => SetValue(ElementInfoIndex.MoleScale, value); } + [UnscopedRef] public Span GetNicknameStorage() { return Storage[0x1c..]; diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Types/Nickname.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Types/Nickname.cs index 6665ca6d4..f5ae991ed 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Types/Nickname.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Types/Nickname.cs @@ -1,5 +1,6 @@ using Ryujinx.Common.Memory; using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.Text; @@ -16,8 +17,10 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types public static Nickname Default => FromString("no name"); public static Nickname Question => FromString("???"); - public Span Raw => _storage.AsSpan(); + [UnscopedRef] + public Span Raw => _storage; + [UnscopedRef] private ReadOnlySpan Characters => MemoryMarshal.Cast(Raw); private int GetEndCharacterIndex() diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs index ab08247b4..f80fbc511 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs @@ -1,5 +1,6 @@ using Ryujinx.Common.Memory; using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Mii.Types @@ -35,7 +36,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types private Array47 _values; - public ReadOnlySpan Values => _values.AsSpan()[..ValuesCount]; + [UnscopedRef] + public ReadOnlySpan Values => _values[..ValuesCount]; } [StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0xC8)] @@ -48,7 +50,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types private Array47 _values; - public ReadOnlySpan Values => _values.AsSpan()[..ValuesCount]; + [UnscopedRef] + public ReadOnlySpan Values => _values[..ValuesCount]; } [StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0xC4)] @@ -60,7 +63,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types private Array47 _values; - public ReadOnlySpan Values => _values.AsSpan()[..ValuesCount]; + [UnscopedRef] + public ReadOnlySpan Values => _values[..ValuesCount]; } public static ReadOnlySpan RandomMiiFacelineArray => MemoryMarshal.Cast(RandomMiiFacelineRawArray); diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Types/Ver3StoreData.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Types/Ver3StoreData.cs index 1c7db8e66..8742a23d0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Types/Ver3StoreData.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Types/Ver3StoreData.cs @@ -1,6 +1,7 @@ using Ryujinx.Common.Memory; using Ryujinx.Common.Utilities; using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Mii.Types @@ -12,7 +13,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types private Array96 _storage; - public Span Storage => _storage.AsSpan(); + [UnscopedRef] + public Span Storage => _storage; // TODO: define all getters/setters } diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs index 9dc75cd2c..5bace4245 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs @@ -626,7 +626,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp Reserved2 = new Array6(), }; - uuid.CopyTo(tagInfo.Uuid.AsSpan()); + uuid.CopyTo(tagInfo.Uuid); context.Memory.Write(outputPosition, tagInfo); diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs index 3d1426530..774f9d625 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs @@ -85,7 +85,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp Reserved1 = new Array64(), Reserved2 = new Array58(), }; - "Ryujinx"u8.CopyTo(registerInfo.Nickname.AsSpan()); + "Ryujinx"u8.CopyTo(registerInfo.Nickname); return registerInfo; } diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs index 581a2906b..cd9e09c12 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs @@ -84,7 +84,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService networkProfile.IpSettingData.IpAddressSetting = new IpAddressSetting(interfaceProperties, unicastAddress); networkProfile.IpSettingData.DnsSetting = new DnsSetting(interfaceProperties); - "RyujinxNetwork"u8.CopyTo(networkProfile.Name.AsSpan()); + "RyujinxNetwork"u8.CopyTo(networkProfile.Name); context.Memory.Write(networkProfileDataPosition, networkProfile); diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSockAddr.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSockAddr.cs index af3a44e88..402bb2a65 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSockAddr.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSockAddr.cs @@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types public IPEndPoint ToIPEndPoint() { - IPAddress address = new(Address.AsSpan()); + IPAddress address = new(Address); int port = (ushort)IPAddress.NetworkToHostOrder((short)Port); return new IPEndPoint(address, port); @@ -31,7 +31,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types Port = (ushort)IPAddress.HostToNetworkOrder((short)endpoint.Port), }; - endpoint.Address.GetAddressBytes().AsSpan().CopyTo(result.Address.AsSpan()); + endpoint.Address.GetAddressBytes().AsSpan().CopyTo(result.Address); return result; } diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfo4.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfo4.cs index 68250022e..9d556a62d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfo4.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfo4.cs @@ -23,7 +23,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types Port = IPAddress.HostToNetworkOrder(port); Address = new Array4(); - address.TryWriteBytes(Address.AsSpan(), out _); + address.TryWriteBytes(Address, out _); } public void ToNetworkOrder() @@ -44,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types { if (BitConverter.IsLittleEndian) { - address.AsSpan().Reverse(); + ((Span)address).Reverse(); } } } diff --git a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs index 58ae1cd8c..fb402f5b9 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs @@ -1442,7 +1442,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone int timeZoneSize = Math.Min(StringUtils.LengthCstr(timeZoneAbbreviation), 8); - timeZoneAbbreviation[..timeZoneSize].CopyTo(calendarAdditionalInfo.TimezoneName.AsSpan()); + timeZoneAbbreviation[..timeZoneSize].CopyTo(calendarAdditionalInfo.TimezoneName); } return result; diff --git a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs index 143e21661..cb86912cc 100644 --- a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs @@ -49,7 +49,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService Height = height, }; - Encoding.ASCII.GetBytes(name).AsSpan().CopyTo(displayInfo.Name.AsSpan()); + Encoding.ASCII.GetBytes(name).AsSpan().CopyTo(displayInfo.Name); _displayInfo.Add(displayInfo); } @@ -171,7 +171,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService return ResultCode.InvalidValue; } - int displayId = _displayInfo.FindIndex(display => Encoding.ASCII.GetString(display.Name.AsSpan()).Trim('\0') == name); + int displayId = _displayInfo.FindIndex(display => Encoding.ASCII.GetString(display.Name).Trim('\0') == name); if (displayId == -1) { diff --git a/src/Ryujinx.Input/Motion/CemuHook/Client.cs b/src/Ryujinx.Input/Motion/CemuHook/Client.cs index b8b936c1e..02e14b89c 100644 --- a/src/Ryujinx.Input/Motion/CemuHook/Client.cs +++ b/src/Ryujinx.Input/Motion/CemuHook/Client.cs @@ -400,10 +400,10 @@ namespace Ryujinx.Input.Motion.CemuHook writer.Seek(6, SeekOrigin.Begin); writer.Write(header.Length); - Crc32.Hash(stream.ToArray(), header.Crc32.AsSpan()); + Crc32.Hash(stream.ToArray(), header.Crc32); writer.Seek(8, SeekOrigin.Begin); - writer.Write(header.Crc32.AsSpan()); + writer.Write(header.Crc32); byte[] data = stream.ToArray(); @@ -438,10 +438,10 @@ namespace Ryujinx.Input.Motion.CemuHook writer.Seek(6, SeekOrigin.Begin); writer.Write(header.Length); - Crc32.Hash(stream.ToArray(), header.Crc32.AsSpan()); + Crc32.Hash(stream.ToArray(), header.Crc32); writer.Seek(8, SeekOrigin.Begin); - writer.Write(header.Crc32.AsSpan()); + writer.Write(header.Crc32); byte[] data = stream.ToArray();