From a5ff0024fb33964c802e1712e5b11a52390603e7 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Thu, 11 Aug 2022 18:07:37 -0300 Subject: [PATCH] Rename ToSpan to AsSpan (#3556) --- .../Renderer/Dsp/DataSourceHelper.cs | 4 +- .../Parameter/Effect/LimiterStatistics.cs | 4 +- .../Renderer/Server/CommandGenerator.cs | 20 +- .../Renderer/Server/Sink/DeviceSink.cs | 4 +- Ryujinx.Audio/Renderer/Server/StateUpdater.cs | 4 +- .../Server/Voice/VoiceChannelResource.cs | 2 +- .../Renderer/Server/Voice/VoiceState.cs | 10 +- Ryujinx.Common/Memory/ArrayPtr.cs | 2 +- .../Memory/PartialUnmaps/PartialUnmapState.cs | 6 +- Ryujinx.Common/Memory/StructArrayHelpers.cs | 260 +++++++++--------- .../Memory/StructByteArrayHelpers.cs | 24 +- .../Commands/SetPatchParametersCommand.cs | 6 +- Ryujinx.Graphics.GAL/ProgramPipelineState.cs | 2 +- Ryujinx.Graphics.GAL/SupportBufferUpdater.cs | 4 +- .../Engine/MmeShadowScratch.cs | 4 +- .../Engine/Threed/StateUpdater.cs | 4 +- .../Shader/ShaderSpecializationState.cs | 2 +- .../Shader/TransformFeedbackDescriptor.cs | 2 +- Ryujinx.Graphics.Nvdec.Vp9/DecodeFrame.cs | 72 ++--- Ryujinx.Graphics.Nvdec.Vp9/DecodeMv.cs | 32 +-- Ryujinx.Graphics.Nvdec.Vp9/Detokenize.cs | 12 +- Ryujinx.Graphics.Nvdec.Vp9/Dsp/Reader.cs | 2 +- Ryujinx.Graphics.Nvdec.Vp9/LoopFilter.cs | 6 +- Ryujinx.Graphics.Vulkan/NativeArray.cs | 2 +- Ryujinx.Graphics.Vulkan/PipelineBase.cs | 4 +- .../PipelineDynamicState.cs | 4 +- Ryujinx.Graphics.Vulkan/PipelineUid.cs | 8 +- Ryujinx.Graphics.Vulkan/ShaderCollection.cs | 2 +- .../Controller/ControllerSupportArgV7.cs | 2 +- .../Controller/ControllerSupportArgVPre7.cs | 2 +- Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs | 4 +- .../Audio/IHardwareOpusDecoderManager.cs | 2 +- .../Friend/ServiceCreator/IFriendService.cs | 6 +- .../Services/Hid/HidDevices/KeyboardDevice.cs | 2 +- .../Services/Hid/HidDevices/NpadDevices.cs | 2 +- .../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 +- Spv.Generator/Instruction.cs | 12 +- Spv.Generator/InstructionOperands.cs | 2 +- 44 files changed, 281 insertions(+), 281 deletions(-) diff --git a/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs b/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs index eda573261..5ca1ddbac 100644 --- a/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs +++ b/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs @@ -76,7 +76,7 @@ namespace Ryujinx.Audio.Renderer.Dsp if (!info.DecodingBehaviour.HasFlag(DecodingBehaviour.SkipPitchAndSampleRateConversion)) { - voiceState.Pitch.ToSpan().Slice(0, pitchMaxLength).CopyTo(tempBuffer); + voiceState.Pitch.AsSpan().Slice(0, 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.ToSpan()); + tempBuffer.Slice(sampleCountToDecode, pitchMaxLength).CopyTo(voiceState.Pitch.AsSpan()); } i += sampleCountToProcess; diff --git a/Ryujinx.Audio/Renderer/Parameter/Effect/LimiterStatistics.cs b/Ryujinx.Audio/Renderer/Parameter/Effect/LimiterStatistics.cs index af4c02f2c..f353f18d1 100644 --- a/Ryujinx.Audio/Renderer/Parameter/Effect/LimiterStatistics.cs +++ b/Ryujinx.Audio/Renderer/Parameter/Effect/LimiterStatistics.cs @@ -24,8 +24,8 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect /// public void Reset() { - InputMax.ToSpan().Fill(0.0f); - CompressionGainMin.ToSpan().Fill(1.0f); + InputMax.AsSpan().Fill(0.0f); + CompressionGainMin.AsSpan().Fill(1.0f); } } } \ No newline at end of file diff --git a/Ryujinx.Audio/Renderer/Server/CommandGenerator.cs b/Ryujinx.Audio/Renderer/Server/CommandGenerator.cs index 514279f1d..87e5c77f9 100644 --- a/Ryujinx.Audio/Renderer/Server/CommandGenerator.cs +++ b/Ryujinx.Audio/Renderer/Server/CommandGenerator.cs @@ -141,7 +141,7 @@ namespace Ryujinx.Audio.Renderer.Server Memory biquadStateRawMemory = SpanMemoryManager.Cast(state).Slice(VoiceUpdateState.BiquadStateOffset, VoiceUpdateState.BiquadStateSize * Constants.VoiceBiquadFilterCount); Memory stateMemory = SpanMemoryManager.Cast(biquadStateRawMemory); - _commandBuffer.GenerateGroupedBiquadFilter(baseIndex, voiceState.BiquadFilters.ToSpan(), stateMemory, bufferOffset, bufferOffset, voiceState.BiquadFilterNeedInitialization, nodeId); + _commandBuffer.GenerateGroupedBiquadFilter(baseIndex, voiceState.BiquadFilters.AsSpan(), 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.ToSpan(), - channelResource.PreviousMix.ToSpan(), + GenerateVoiceMix(channelResource.Mix.AsSpan(), + channelResource.PreviousMix.AsSpan(), dspStateMemory, mix.BufferOffset, mix.BufferCount, @@ -505,8 +505,8 @@ namespace Ryujinx.Audio.Renderer.Server BiquadFilterParameter parameter = new BiquadFilterParameter(); parameter.Enable = true; - effect.Parameter.Denominator.ToSpan().CopyTo(parameter.Denominator.ToSpan()); - effect.Parameter.Numerator.ToSpan().CopyTo(parameter.Numerator.ToSpan()); + effect.Parameter.Denominator.AsSpan().CopyTo(parameter.Denominator.AsSpan()); + effect.Parameter.Numerator.AsSpan().CopyTo(parameter.Numerator.AsSpan()); for (int i = 0; i < effect.Parameter.ChannelCount; i++) { @@ -923,8 +923,8 @@ namespace Ryujinx.Audio.Renderer.Server if (useCustomDownMixingCommand) { _commandBuffer.GenerateDownMixSurroundToStereo(finalMix.BufferOffset, - sink.Parameter.Input.ToSpan(), - sink.Parameter.Input.ToSpan(), + sink.Parameter.Input.AsSpan(), + sink.Parameter.Input.AsSpan(), sink.DownMixCoefficients, Constants.InvalidNodeId); } @@ -932,8 +932,8 @@ namespace Ryujinx.Audio.Renderer.Server else if (_rendererContext.ChannelCount == 2 && sink.Parameter.InputCount == 6) { _commandBuffer.GenerateDownMixSurroundToStereo(finalMix.BufferOffset, - sink.Parameter.Input.ToSpan(), - sink.Parameter.Input.ToSpan(), + sink.Parameter.Input.AsSpan(), + sink.Parameter.Input.AsSpan(), Constants.DefaultSurroundToStereoCoefficients, Constants.InvalidNodeId); } @@ -945,7 +945,7 @@ namespace Ryujinx.Audio.Renderer.Server _commandBuffer.GenerateUpsample(finalMix.BufferOffset, sink.UpsamplerState, sink.Parameter.InputCount, - sink.Parameter.Input.ToSpan(), + sink.Parameter.Input.AsSpan(), commandList.BufferCount, commandList.SampleCount, commandList.SampleRate, diff --git a/Ryujinx.Audio/Renderer/Server/Sink/DeviceSink.cs b/Ryujinx.Audio/Renderer/Server/Sink/DeviceSink.cs index 970e145e8..de345d3ad 100644 --- a/Ryujinx.Audio/Renderer/Server/Sink/DeviceSink.cs +++ b/Ryujinx.Audio/Renderer/Server/Sink/DeviceSink.cs @@ -63,10 +63,10 @@ namespace Ryujinx.Audio.Renderer.Server.Sink else { Parameter.DownMixParameterEnabled = inputDeviceParameter.DownMixParameterEnabled; - inputDeviceParameter.DownMixParameter.ToSpan().CopyTo(Parameter.DownMixParameter.ToSpan()); + inputDeviceParameter.DownMixParameter.AsSpan().CopyTo(Parameter.DownMixParameter.AsSpan()); } - Parameter.DownMixParameter.ToSpan().CopyTo(DownMixCoefficients.AsSpan()); + Parameter.DownMixParameter.AsSpan().CopyTo(DownMixCoefficients.AsSpan()); errorInfo = new BehaviourParameter.ErrorInfo(); outStatus = new SinkOutStatus(); diff --git a/Ryujinx.Audio/Renderer/Server/StateUpdater.cs b/Ryujinx.Audio/Renderer/Server/StateUpdater.cs index 0514c3555..0c2cfa7ea 100644 --- a/Ryujinx.Audio/Renderer/Server/StateUpdater.cs +++ b/Ryujinx.Audio/Renderer/Server/StateUpdater.cs @@ -119,7 +119,7 @@ namespace Ryujinx.Audio.Renderer.Server ref VoiceChannelResource resource = ref context.GetChannelResource(i); resource.Id = parameter.Id; - parameter.Mix.ToSpan().CopyTo(resource.Mix.ToSpan()); + parameter.Mix.AsSpan().CopyTo(resource.Mix.AsSpan()); resource.IsUsed = parameter.IsUsed; } @@ -587,7 +587,7 @@ namespace Ryujinx.Audio.Renderer.Server { ref BehaviourErrorInfoOutStatus outStatus = ref SpanIOHelper.GetWriteRef(ref _output)[0]; - _behaviourContext.CopyErrorInfo(outStatus.ErrorInfos.ToSpan(), out outStatus.ErrorInfosCount); + _behaviourContext.CopyErrorInfo(outStatus.ErrorInfos.AsSpan(), out outStatus.ErrorInfosCount); OutputHeader.BehaviourSize = (uint)Unsafe.SizeOf(); OutputHeader.TotalSize += OutputHeader.BehaviourSize; diff --git a/Ryujinx.Audio/Renderer/Server/Voice/VoiceChannelResource.cs b/Ryujinx.Audio/Renderer/Server/Voice/VoiceChannelResource.cs index 81736630d..939d92944 100644 --- a/Ryujinx.Audio/Renderer/Server/Voice/VoiceChannelResource.cs +++ b/Ryujinx.Audio/Renderer/Server/Voice/VoiceChannelResource.cs @@ -34,7 +34,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice public void UpdateState() { - Mix.ToSpan().CopyTo(PreviousMix.ToSpan()); + Mix.AsSpan().CopyTo(PreviousMix.AsSpan()); } } } \ No newline at end of file diff --git a/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs b/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs index 004b5aa24..006d6dd3c 100644 --- a/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs +++ b/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs @@ -202,7 +202,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice Pitch = 0.0f; Volume = 0.0f; PreviousVolume = 0.0f; - BiquadFilters.ToSpan().Fill(new BiquadFilterParameter()); + BiquadFilters.AsSpan().Fill(new BiquadFilterParameter()); WaveBuffersCount = 0; WaveBuffersIndex = 0; MixId = Constants.UnusedMixId; @@ -288,7 +288,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice ChannelsCount = parameter.ChannelCount; Pitch = parameter.Pitch; Volume = parameter.Volume; - parameter.BiquadFilters.ToSpan().CopyTo(BiquadFilters.ToSpan()); + parameter.BiquadFilters.AsSpan().CopyTo(BiquadFilters.AsSpan()); WaveBuffersCount = parameter.WaveBuffersCount; WaveBuffersIndex = parameter.WaveBuffersIndex; @@ -308,7 +308,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice SplitterId = Constants.UnusedSplitterId; } - parameter.ChannelResourceIds.ToSpan().CopyTo(ChannelResourceIds.ToSpan()); + parameter.ChannelResourceIds.AsSpan().CopyTo(ChannelResourceIds.AsSpan()); DecodingBehaviour behaviour = DecodingBehaviour.Default; @@ -638,7 +638,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice voiceUpdateState.Offset = 0; voiceUpdateState.PlayedSampleCount = 0; - voiceUpdateState.Pitch.ToSpan().Fill(0); + voiceUpdateState.Pitch.AsSpan().Fill(0); voiceUpdateState.Fraction = 0; voiceUpdateState.LoopContext = new Dsp.State.AdpcmLoopContext(); } @@ -650,7 +650,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice case Types.PlayState.Stopped: case Types.PlayState.Paused: - foreach (ref WaveBuffer wavebuffer in WaveBuffers.ToSpan()) + foreach (ref WaveBuffer wavebuffer in WaveBuffers.AsSpan()) { wavebuffer.BufferAddressInfo.GetReference(true); wavebuffer.ContextAddressInfo.GetReference(true); diff --git a/Ryujinx.Common/Memory/ArrayPtr.cs b/Ryujinx.Common/Memory/ArrayPtr.cs index 7a145de2e..9e95f75ee 100644 --- a/Ryujinx.Common/Memory/ArrayPtr.cs +++ b/Ryujinx.Common/Memory/ArrayPtr.cs @@ -87,7 +87,7 @@ namespace Ryujinx.Common.Memory /// Gets a span from the array. /// /// Span of the array - public Span ToSpan() => Length == 0 ? Span.Empty : MemoryMarshal.CreateSpan(ref this[0], Length); + public Span AsSpan() => Length == 0 ? Span.Empty : MemoryMarshal.CreateSpan(ref this[0], Length); /// /// Gets the array base pointer. diff --git a/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs b/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs index 3b42e140b..7a14e616f 100644 --- a/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs +++ b/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs @@ -83,7 +83,7 @@ namespace Ryujinx.Common.Memory.PartialUnmaps /// memory might be accessed but is unmapped. Users of the API must compensate for that by catching the /// access violation and retrying if it happened between the unmap and remap operation. /// This method can be used to decide if retrying in such cases is necessary or not. - /// + /// /// This version of the function is not used, but serves as a reference for the native /// implementation in ARMeilleure. /// @@ -128,12 +128,12 @@ namespace Ryujinx.Common.Memory.PartialUnmaps const uint ExitCodeStillActive = 259; const int ThreadQueryInformation = 0x40; - Span ids = LocalCounts.ThreadIds.ToSpan(); + Span ids = LocalCounts.ThreadIds.AsSpan(); for (int i = 0; i < ids.Length; i++) { int id = ids[i]; - + if (id != 0) { IntPtr handle = OpenThread(ThreadQueryInformation, false, (uint)id); diff --git a/Ryujinx.Common/Memory/StructArrayHelpers.cs b/Ryujinx.Common/Memory/StructArrayHelpers.cs index bba05c10b..a039d04e7 100644 --- a/Ryujinx.Common/Memory/StructArrayHelpers.cs +++ b/Ryujinx.Common/Memory/StructArrayHelpers.cs @@ -7,8 +7,8 @@ namespace Ryujinx.Common.Memory { T _e0; public int Length => 1; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 1); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 1); } public struct Array2 : IArray where T : unmanaged { @@ -17,8 +17,8 @@ namespace Ryujinx.Common.Memory Array1 _other; #pragma warning restore CS0169 public int Length => 2; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 2); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 2); } public struct Array3 : IArray where T : unmanaged { @@ -27,8 +27,8 @@ namespace Ryujinx.Common.Memory Array2 _other; #pragma warning restore CS0169 public int Length => 3; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 3); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 3); } public struct Array4 : IArray where T : unmanaged { @@ -37,8 +37,8 @@ namespace Ryujinx.Common.Memory Array3 _other; #pragma warning restore CS0169 public int Length => 4; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 4); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 4); } public struct Array5 : IArray where T : unmanaged { @@ -47,8 +47,8 @@ namespace Ryujinx.Common.Memory Array4 _other; #pragma warning restore CS0169 public int Length => 5; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 5); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 5); } public struct Array6 : IArray where T : unmanaged { @@ -57,8 +57,8 @@ namespace Ryujinx.Common.Memory Array5 _other; #pragma warning restore CS0169 public int Length => 6; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 6); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 6); } public struct Array7 : IArray where T : unmanaged { @@ -67,8 +67,8 @@ namespace Ryujinx.Common.Memory Array6 _other; #pragma warning restore CS0169 public int Length => 7; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 7); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 7); } public struct Array8 : IArray where T : unmanaged { @@ -77,8 +77,8 @@ namespace Ryujinx.Common.Memory Array7 _other; #pragma warning restore CS0169 public int Length => 8; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 8); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 8); } public struct Array9 : IArray where T : unmanaged { @@ -87,8 +87,8 @@ namespace Ryujinx.Common.Memory Array8 _other; #pragma warning restore CS0169 public int Length => 9; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 9); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 9); } public struct Array10 : IArray where T : unmanaged { @@ -97,8 +97,8 @@ namespace Ryujinx.Common.Memory Array9 _other; #pragma warning restore CS0169 public int Length => 10; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 10); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 10); } public struct Array11 : IArray where T : unmanaged { @@ -107,8 +107,8 @@ namespace Ryujinx.Common.Memory Array10 _other; #pragma warning restore CS0169 public int Length => 11; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 11); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 11); } public struct Array12 : IArray where T : unmanaged { @@ -117,8 +117,8 @@ namespace Ryujinx.Common.Memory Array11 _other; #pragma warning restore CS0169 public int Length => 12; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 12); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 12); } public struct Array13 : IArray where T : unmanaged { @@ -127,8 +127,8 @@ namespace Ryujinx.Common.Memory Array12 _other; #pragma warning restore CS0169 public int Length => 13; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 13); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 13); } public struct Array14 : IArray where T : unmanaged { @@ -137,8 +137,8 @@ namespace Ryujinx.Common.Memory Array13 _other; #pragma warning restore CS0169 public int Length => 14; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 14); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 14); } public struct Array15 : IArray where T : unmanaged { @@ -147,8 +147,8 @@ namespace Ryujinx.Common.Memory Array14 _other; #pragma warning restore CS0169 public int Length => 15; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 15); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 15); } public struct Array16 : IArray where T : unmanaged { @@ -157,8 +157,8 @@ namespace Ryujinx.Common.Memory Array15 _other; #pragma warning restore CS0169 public int Length => 16; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 16); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 16); } public struct Array17 : IArray where T : unmanaged { @@ -167,8 +167,8 @@ namespace Ryujinx.Common.Memory Array16 _other; #pragma warning restore CS0169 public int Length => 17; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 17); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 17); } public struct Array18 : IArray where T : unmanaged { @@ -177,8 +177,8 @@ namespace Ryujinx.Common.Memory Array17 _other; #pragma warning restore CS0169 public int Length => 18; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 18); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 18); } public struct Array19 : IArray where T : unmanaged { @@ -187,8 +187,8 @@ namespace Ryujinx.Common.Memory Array18 _other; #pragma warning restore CS0169 public int Length => 19; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 19); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 19); } public struct Array20 : IArray where T : unmanaged { @@ -197,8 +197,8 @@ namespace Ryujinx.Common.Memory Array19 _other; #pragma warning restore CS0169 public int Length => 20; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 20); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 20); } public struct Array21 : IArray where T : unmanaged { @@ -207,8 +207,8 @@ namespace Ryujinx.Common.Memory Array20 _other; #pragma warning restore CS0169 public int Length => 21; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 21); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 21); } public struct Array22 : IArray where T : unmanaged { @@ -217,8 +217,8 @@ namespace Ryujinx.Common.Memory Array21 _other; #pragma warning restore CS0169 public int Length => 22; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 22); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 22); } public struct Array23 : IArray where T : unmanaged { @@ -227,8 +227,8 @@ namespace Ryujinx.Common.Memory Array22 _other; #pragma warning restore CS0169 public int Length => 23; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 23); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 23); } public struct Array24 : IArray where T : unmanaged { @@ -237,8 +237,8 @@ namespace Ryujinx.Common.Memory Array23 _other; #pragma warning restore CS0169 public int Length => 24; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 24); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 24); } public struct Array25 : IArray where T : unmanaged { @@ -247,8 +247,8 @@ namespace Ryujinx.Common.Memory Array24 _other; #pragma warning restore CS0169 public int Length => 25; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 25); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 25); } public struct Array26 : IArray where T : unmanaged { @@ -257,8 +257,8 @@ namespace Ryujinx.Common.Memory Array25 _other; #pragma warning restore CS0169 public int Length => 26; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 26); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 26); } public struct Array27 : IArray where T : unmanaged { @@ -267,8 +267,8 @@ namespace Ryujinx.Common.Memory Array26 _other; #pragma warning restore CS0169 public int Length => 27; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 27); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 27); } public struct Array28 : IArray where T : unmanaged { @@ -277,8 +277,8 @@ namespace Ryujinx.Common.Memory Array27 _other; #pragma warning restore CS0169 public int Length => 28; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 28); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 28); } public struct Array29 : IArray where T : unmanaged { @@ -287,8 +287,8 @@ namespace Ryujinx.Common.Memory Array28 _other; #pragma warning restore CS0169 public int Length => 29; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 29); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 29); } public struct Array30 : IArray where T : unmanaged { @@ -297,8 +297,8 @@ namespace Ryujinx.Common.Memory Array29 _other; #pragma warning restore CS0169 public int Length => 30; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 30); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 30); } public struct Array31 : IArray where T : unmanaged { @@ -307,8 +307,8 @@ namespace Ryujinx.Common.Memory Array30 _other; #pragma warning restore CS0169 public int Length => 31; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 31); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 31); } public struct Array32 : IArray where T : unmanaged { @@ -317,8 +317,8 @@ namespace Ryujinx.Common.Memory Array31 _other; #pragma warning restore CS0169 public int Length => 32; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 32); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 32); } public struct Array33 : IArray where T : unmanaged { @@ -327,8 +327,8 @@ namespace Ryujinx.Common.Memory Array32 _other; #pragma warning restore CS0169 public int Length => 33; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 33); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 33); } public struct Array34 : IArray where T : unmanaged { @@ -337,8 +337,8 @@ namespace Ryujinx.Common.Memory Array33 _other; #pragma warning restore CS0169 public int Length => 34; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 34); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 34); } public struct Array35 : IArray where T : unmanaged { @@ -347,8 +347,8 @@ namespace Ryujinx.Common.Memory Array34 _other; #pragma warning restore CS0169 public int Length => 35; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 35); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 35); } public struct Array36 : IArray where T : unmanaged { @@ -357,8 +357,8 @@ namespace Ryujinx.Common.Memory Array35 _other; #pragma warning restore CS0169 public int Length => 36; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 36); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 36); } public struct Array37 : IArray where T : unmanaged { @@ -367,8 +367,8 @@ namespace Ryujinx.Common.Memory Array36 _other; #pragma warning restore CS0169 public int Length => 37; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 37); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 37); } public struct Array38 : IArray where T : unmanaged { @@ -377,8 +377,8 @@ namespace Ryujinx.Common.Memory Array37 _other; #pragma warning restore CS0169 public int Length => 38; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 38); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 38); } public struct Array39 : IArray where T : unmanaged { @@ -387,8 +387,8 @@ namespace Ryujinx.Common.Memory Array38 _other; #pragma warning restore CS0169 public int Length => 39; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 39); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 39); } public struct Array40 : IArray where T : unmanaged { @@ -397,8 +397,8 @@ namespace Ryujinx.Common.Memory Array39 _other; #pragma warning restore CS0169 public int Length => 40; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 40); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 40); } public struct Array41 : IArray where T : unmanaged { @@ -407,8 +407,8 @@ namespace Ryujinx.Common.Memory Array40 _other; #pragma warning restore CS0169 public int Length => 41; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 41); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 41); } public struct Array42 : IArray where T : unmanaged { @@ -417,8 +417,8 @@ namespace Ryujinx.Common.Memory Array41 _other; #pragma warning restore CS0169 public int Length => 42; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 42); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 42); } public struct Array43 : IArray where T : unmanaged { @@ -427,8 +427,8 @@ namespace Ryujinx.Common.Memory Array42 _other; #pragma warning restore CS0169 public int Length => 43; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 43); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 43); } public struct Array44 : IArray where T : unmanaged { @@ -437,8 +437,8 @@ namespace Ryujinx.Common.Memory Array43 _other; #pragma warning restore CS0169 public int Length => 44; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 44); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 44); } public struct Array45 : IArray where T : unmanaged { @@ -447,8 +447,8 @@ namespace Ryujinx.Common.Memory Array44 _other; #pragma warning restore CS0169 public int Length => 45; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 45); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 45); } public struct Array46 : IArray where T : unmanaged { @@ -457,8 +457,8 @@ namespace Ryujinx.Common.Memory Array45 _other; #pragma warning restore CS0169 public int Length => 46; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 46); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 46); } public struct Array47 : IArray where T : unmanaged { @@ -467,8 +467,8 @@ namespace Ryujinx.Common.Memory Array46 _other; #pragma warning restore CS0169 public int Length => 47; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 47); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 47); } public struct Array48 : IArray where T : unmanaged { @@ -477,8 +477,8 @@ namespace Ryujinx.Common.Memory Array47 _other; #pragma warning restore CS0169 public int Length => 48; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 48); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 48); } public struct Array49 : IArray where T : unmanaged { @@ -487,8 +487,8 @@ namespace Ryujinx.Common.Memory Array48 _other; #pragma warning restore CS0169 public int Length => 49; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 49); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 49); } public struct Array50 : IArray where T : unmanaged { @@ -497,8 +497,8 @@ namespace Ryujinx.Common.Memory Array49 _other; #pragma warning restore CS0169 public int Length => 50; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 50); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 50); } public struct Array51 : IArray where T : unmanaged { @@ -507,8 +507,8 @@ namespace Ryujinx.Common.Memory Array50 _other; #pragma warning restore CS0169 public int Length => 51; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 51); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 51); } public struct Array52 : IArray where T : unmanaged { @@ -517,8 +517,8 @@ namespace Ryujinx.Common.Memory Array51 _other; #pragma warning restore CS0169 public int Length => 52; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 52); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 52); } public struct Array53 : IArray where T : unmanaged { @@ -527,8 +527,8 @@ namespace Ryujinx.Common.Memory Array52 _other; #pragma warning restore CS0169 public int Length => 53; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 53); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 53); } public struct Array54 : IArray where T : unmanaged { @@ -537,8 +537,8 @@ namespace Ryujinx.Common.Memory Array53 _other; #pragma warning restore CS0169 public int Length => 54; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 54); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 54); } public struct Array55 : IArray where T : unmanaged { @@ -547,8 +547,8 @@ namespace Ryujinx.Common.Memory Array54 _other; #pragma warning restore CS0169 public int Length => 55; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 55); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 55); } public struct Array56 : IArray where T : unmanaged { @@ -557,8 +557,8 @@ namespace Ryujinx.Common.Memory Array55 _other; #pragma warning restore CS0169 public int Length => 56; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 56); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 56); } public struct Array57 : IArray where T : unmanaged { @@ -567,8 +567,8 @@ namespace Ryujinx.Common.Memory Array56 _other; #pragma warning restore CS0169 public int Length => 57; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 57); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 57); } public struct Array58 : IArray where T : unmanaged { @@ -577,8 +577,8 @@ namespace Ryujinx.Common.Memory Array57 _other; #pragma warning restore CS0169 public int Length => 58; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 58); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 58); } public struct Array59 : IArray where T : unmanaged { @@ -587,8 +587,8 @@ namespace Ryujinx.Common.Memory Array58 _other; #pragma warning restore CS0169 public int Length => 59; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 59); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 59); } public struct Array60 : IArray where T : unmanaged { @@ -597,8 +597,8 @@ namespace Ryujinx.Common.Memory Array59 _other; #pragma warning restore CS0169 public int Length => 60; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 60); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 60); } public struct Array61 : IArray where T : unmanaged { @@ -607,8 +607,8 @@ namespace Ryujinx.Common.Memory Array60 _other; #pragma warning restore CS0169 public int Length => 61; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 61); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 61); } public struct Array62 : IArray where T : unmanaged { @@ -617,8 +617,8 @@ namespace Ryujinx.Common.Memory Array61 _other; #pragma warning restore CS0169 public int Length => 62; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 62); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 62); } public struct Array63 : IArray where T : unmanaged { @@ -627,8 +627,8 @@ namespace Ryujinx.Common.Memory Array62 _other; #pragma warning restore CS0169 public int Length => 63; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 63); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 63); } public struct Array64 : IArray where T : unmanaged { @@ -637,8 +637,8 @@ namespace Ryujinx.Common.Memory Array63 _other; #pragma warning restore CS0169 public int Length => 64; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 64); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 64); } public struct Array73 : IArray where T : unmanaged { @@ -648,7 +648,7 @@ namespace Ryujinx.Common.Memory Array8 _other2; #pragma warning restore CS0169 public int Length => 73; - public ref T this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 73); + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 73); } } diff --git a/Ryujinx.Common/Memory/StructByteArrayHelpers.cs b/Ryujinx.Common/Memory/StructByteArrayHelpers.cs index 0c17dc10e..8693f5b84 100644 --- a/Ryujinx.Common/Memory/StructByteArrayHelpers.cs +++ b/Ryujinx.Common/Memory/StructByteArrayHelpers.cs @@ -11,8 +11,8 @@ namespace Ryujinx.Common.Memory byte _element; public int Length => Size; - public ref byte this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _element, Size); + public ref byte this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } [StructLayout(LayoutKind.Sequential, Size = Size, Pack = 1)] @@ -23,8 +23,8 @@ namespace Ryujinx.Common.Memory byte _element; public int Length => Size; - public ref byte this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _element, Size); + public ref byte this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } [StructLayout(LayoutKind.Sequential, Size = Size, Pack = 1)] @@ -35,8 +35,8 @@ namespace Ryujinx.Common.Memory byte _element; public int Length => Size; - public ref byte this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _element, Size); + public ref byte this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } [StructLayout(LayoutKind.Sequential, Size = Size, Pack = 1)] @@ -47,8 +47,8 @@ namespace Ryujinx.Common.Memory byte _element; public int Length => Size; - public ref byte this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _element, Size); + public ref byte this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } [StructLayout(LayoutKind.Sequential, Size = Size, Pack = 1)] @@ -59,8 +59,8 @@ namespace Ryujinx.Common.Memory byte _element; public int Length => Size; - public ref byte this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _element, Size); + public ref byte this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } [StructLayout(LayoutKind.Sequential, Size = Size, Pack = 1)] @@ -71,7 +71,7 @@ namespace Ryujinx.Common.Memory byte _element; public int Length => Size; - public ref byte this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _element, Size); + public ref byte this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } } diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs index 7847e8d08..d67cfc692 100644 --- a/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs +++ b/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.ToSpan()); - defaultInnerLevel.CopyTo(_defaultInnerLevel.ToSpan()); + defaultOuterLevel.CopyTo(_defaultOuterLevel.AsSpan()); + defaultInnerLevel.CopyTo(_defaultInnerLevel.AsSpan()); } public static void Run(ref SetPatchParametersCommand command, ThreadedRenderer threaded, IRenderer renderer) { - renderer.Pipeline.SetPatchParameters(command._vertices, command._defaultOuterLevel.ToSpan(), command._defaultInnerLevel.ToSpan()); + renderer.Pipeline.SetPatchParameters(command._vertices, command._defaultOuterLevel.AsSpan(), command._defaultInnerLevel.AsSpan()); } } } diff --git a/Ryujinx.Graphics.GAL/ProgramPipelineState.cs b/Ryujinx.Graphics.GAL/ProgramPipelineState.cs index 10a4164e6..887282071 100644 --- a/Ryujinx.Graphics.GAL/ProgramPipelineState.cs +++ b/Ryujinx.Graphics.GAL/ProgramPipelineState.cs @@ -66,7 +66,7 @@ namespace Ryujinx.Graphics.GAL public void SetVertexAttribs(ReadOnlySpan vertexAttribs) { VertexAttribCount = vertexAttribs.Length; - vertexAttribs.CopyTo(VertexAttribs.ToSpan()); + vertexAttribs.CopyTo(VertexAttribs.AsSpan()); } public void SetLogicOpState(bool enable, LogicalOp op) diff --git a/Ryujinx.Graphics.GAL/SupportBufferUpdater.cs b/Ryujinx.Graphics.GAL/SupportBufferUpdater.cs index 5d73b45aa..6eeddb6c0 100644 --- a/Ryujinx.Graphics.GAL/SupportBufferUpdater.cs +++ b/Ryujinx.Graphics.GAL/SupportBufferUpdater.cs @@ -65,12 +65,12 @@ namespace Ryujinx.Graphics.GAL public void UpdateRenderScale(ReadOnlySpan> data, int offset, int count) { - UpdateGenericField(SupportBuffer.GraphicsRenderScaleOffset, data, Data.RenderScale.ToSpan(), offset, count); + UpdateGenericField(SupportBuffer.GraphicsRenderScaleOffset, data, Data.RenderScale.AsSpan(), offset, count); } public void UpdateFragmentIsBgra(ReadOnlySpan> data, int offset, int count) { - UpdateGenericField(SupportBuffer.FragmentIsBgraOffset, data, Data.FragmentIsBgra.ToSpan(), offset, count); + UpdateGenericField(SupportBuffer.FragmentIsBgraOffset, data, Data.FragmentIsBgra.AsSpan(), offset, count); } public void UpdateViewportInverse(Vector4 data) diff --git a/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs b/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs index a32956168..44cd82130 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MmeShadowScratch.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Gpu.Engine #pragma warning disable CS0169 private uint _e0; #pragma warning restore CS0169 - public ref uint this[int index] => ref ToSpan()[index]; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref _e0, 256); + public ref uint this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 256); } } diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs index ccbccca13..10d5cd8ca 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs @@ -331,8 +331,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed _context.Renderer.Pipeline.SetPatchParameters( _state.State.PatchVertices, - _state.State.TessOuterLevel.ToSpan(), - _state.State.TessInnerLevel.ToSpan()); + _state.State.TessOuterLevel.AsSpan(), + _state.State.TessInnerLevel.AsSpan()); } /// diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs index c927f33d4..a8047f08c 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs @@ -515,7 +515,7 @@ namespace Ryujinx.Graphics.Gpu.Shader return false; } - if (!graphicsState.AttributeTypes.ToSpan().SequenceEqual(GraphicsState.AttributeTypes.ToSpan())) + if (!graphicsState.AttributeTypes.AsSpan().SequenceEqual(GraphicsState.AttributeTypes.AsSpan())) { return false; } diff --git a/Ryujinx.Graphics.Gpu/Shader/TransformFeedbackDescriptor.cs b/Ryujinx.Graphics.Gpu/Shader/TransformFeedbackDescriptor.cs index 09f1df760..5baf2a1a6 100644 --- a/Ryujinx.Graphics.Gpu/Shader/TransformFeedbackDescriptor.cs +++ b/Ryujinx.Graphics.Gpu/Shader/TransformFeedbackDescriptor.cs @@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Gpu.Shader /// Span of varying locations public ReadOnlySpan AsSpan() { - return MemoryMarshal.Cast(VaryingLocations.ToSpan()).Slice(0, Math.Min(128, VaryingCount)); + return MemoryMarshal.Cast(VaryingLocations.AsSpan()).Slice(0, Math.Min(128, VaryingCount)); } } } diff --git a/Ryujinx.Graphics.Nvdec.Vp9/DecodeFrame.cs b/Ryujinx.Graphics.Nvdec.Vp9/DecodeFrame.cs index 2963f7cf8..abebb4b7c 100644 --- a/Ryujinx.Graphics.Nvdec.Vp9/DecodeFrame.cs +++ b/Ryujinx.Graphics.Nvdec.Vp9/DecodeFrame.cs @@ -30,23 +30,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 Span dst16 = MemoryMarshal.Cast(dst); if (xd.Lossless) { - Idct.HighbdIwht4x4Add(dqcoeff.ToSpan(), dst16, stride, eob, xd.Bd); + Idct.HighbdIwht4x4Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); } else { switch (txSize) { case TxSize.Tx4x4: - Idct.HighbdIdct4x4Add(dqcoeff.ToSpan(), dst16, stride, eob, xd.Bd); + Idct.HighbdIdct4x4Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); break; case TxSize.Tx8x8: - Idct.HighbdIdct8x8Add(dqcoeff.ToSpan(), dst16, stride, eob, xd.Bd); + Idct.HighbdIdct8x8Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); break; case TxSize.Tx16x16: - Idct.HighbdIdct16x16Add(dqcoeff.ToSpan(), dst16, stride, eob, xd.Bd); + Idct.HighbdIdct16x16Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); break; case TxSize.Tx32x32: - Idct.HighbdIdct32x32Add(dqcoeff.ToSpan(), dst16, stride, eob, xd.Bd); + Idct.HighbdIdct32x32Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); break; default: Debug.Assert(false, "Invalid transform size"); break; } @@ -56,16 +56,16 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 { if (xd.Lossless) { - Idct.Iwht4x4Add(dqcoeff.ToSpan(), dst, stride, eob); + Idct.Iwht4x4Add(dqcoeff.AsSpan(), dst, stride, eob); } else { switch (txSize) { - case TxSize.Tx4x4: Idct.Idct4x4Add(dqcoeff.ToSpan(), dst, stride, eob); break; - case TxSize.Tx8x8: Idct.Idct8x8Add(dqcoeff.ToSpan(), dst, stride, eob); break; - case TxSize.Tx16x16: Idct.Idct16x16Add(dqcoeff.ToSpan(), dst, stride, eob); break; - case TxSize.Tx32x32: Idct.Idct32x32Add(dqcoeff.ToSpan(), dst, stride, eob); break; + case TxSize.Tx4x4: Idct.Idct4x4Add(dqcoeff.AsSpan(), dst, stride, eob); break; + case TxSize.Tx8x8: Idct.Idct8x8Add(dqcoeff.AsSpan(), dst, stride, eob); break; + case TxSize.Tx16x16: Idct.Idct16x16Add(dqcoeff.AsSpan(), dst, stride, eob); break; + case TxSize.Tx32x32: Idct.Idct32x32Add(dqcoeff.AsSpan(), dst, stride, eob); break; default: Debug.Assert(false, "Invalid transform size"); return; } } @@ -73,21 +73,21 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 if (eob == 1) { - dqcoeff.ToSpan()[0] = 0; + dqcoeff.AsSpan()[0] = 0; } else { if (txSize <= TxSize.Tx16x16 && eob <= 10) { - dqcoeff.ToSpan().Slice(0, 4 * (4 << (int)txSize)).Fill(0); + dqcoeff.AsSpan().Slice(0, 4 * (4 << (int)txSize)).Fill(0); } else if (txSize == TxSize.Tx32x32 && eob <= 34) { - dqcoeff.ToSpan().Slice(0, 256).Fill(0); + dqcoeff.AsSpan().Slice(0, 256).Fill(0); } else { - dqcoeff.ToSpan().Slice(0, 16 << ((int)txSize << 1)).Fill(0); + dqcoeff.AsSpan().Slice(0, 16 << ((int)txSize << 1)).Fill(0); } } } @@ -109,23 +109,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 Span dst16 = MemoryMarshal.Cast(dst); if (xd.Lossless) { - Idct.HighbdIwht4x4Add(dqcoeff.ToSpan(), dst16, stride, eob, xd.Bd); + Idct.HighbdIwht4x4Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); } else { switch (txSize) { case TxSize.Tx4x4: - Idct.HighbdIht4x4Add(txType, dqcoeff.ToSpan(), dst16, stride, eob, xd.Bd); + Idct.HighbdIht4x4Add(txType, dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); break; case TxSize.Tx8x8: - Idct.HighbdIht8x8Add(txType, dqcoeff.ToSpan(), dst16, stride, eob, xd.Bd); + Idct.HighbdIht8x8Add(txType, dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); break; case TxSize.Tx16x16: - Idct.HighbdIht16x16Add(txType, dqcoeff.ToSpan(), dst16, stride, eob, xd.Bd); + Idct.HighbdIht16x16Add(txType, dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); break; case TxSize.Tx32x32: - Idct.HighbdIdct32x32Add(dqcoeff.ToSpan(), dst16, stride, eob, xd.Bd); + Idct.HighbdIdct32x32Add(dqcoeff.AsSpan(), dst16, stride, eob, xd.Bd); break; default: Debug.Assert(false, "Invalid transform size"); break; } @@ -135,16 +135,16 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 { if (xd.Lossless) { - Idct.Iwht4x4Add(dqcoeff.ToSpan(), dst, stride, eob); + Idct.Iwht4x4Add(dqcoeff.AsSpan(), dst, stride, eob); } else { switch (txSize) { - case TxSize.Tx4x4: Idct.Iht4x4Add(txType, dqcoeff.ToSpan(), dst, stride, eob); break; - case TxSize.Tx8x8: Idct.Iht8x8Add(txType, dqcoeff.ToSpan(), dst, stride, eob); break; - case TxSize.Tx16x16: Idct.Iht16x16Add(txType, dqcoeff.ToSpan(), dst, stride, eob); break; - case TxSize.Tx32x32: Idct.Idct32x32Add(dqcoeff.ToSpan(), dst, stride, eob); break; + case TxSize.Tx4x4: Idct.Iht4x4Add(txType, dqcoeff.AsSpan(), dst, stride, eob); break; + case TxSize.Tx8x8: Idct.Iht8x8Add(txType, dqcoeff.AsSpan(), dst, stride, eob); break; + case TxSize.Tx16x16: Idct.Iht16x16Add(txType, dqcoeff.AsSpan(), dst, stride, eob); break; + case TxSize.Tx32x32: Idct.Idct32x32Add(dqcoeff.AsSpan(), dst, stride, eob); break; default: Debug.Assert(false, "Invalid transform size"); return; } } @@ -152,21 +152,21 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 if (eob == 1) { - dqcoeff.ToSpan()[0] = 0; + dqcoeff.AsSpan()[0] = 0; } else { if (txType == TxType.DctDct && txSize <= TxSize.Tx16x16 && eob <= 10) { - dqcoeff.ToSpan().Slice(0, 4 * (4 << (int)txSize)).Fill(0); + dqcoeff.AsSpan().Slice(0, 4 * (4 << (int)txSize)).Fill(0); } else if (txSize == TxSize.Tx32x32 && eob <= 34) { - dqcoeff.ToSpan().Slice(0, 256).Fill(0); + dqcoeff.AsSpan().Slice(0, 256).Fill(0); } else { - dqcoeff.ToSpan().Slice(0, 16 << ((int)txSize << 1)).Fill(0); + dqcoeff.AsSpan().Slice(0, 16 << ((int)txSize << 1)).Fill(0); } } } @@ -184,7 +184,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 PredictionMode mode = (plane == 0) ? mi.Mode : mi.UvMode; int dstOffset = 4 * row * pd.Dst.Stride + 4 * col; byte* dst = &pd.Dst.Buf.ToPointer()[dstOffset]; - Span dstSpan = pd.Dst.Buf.ToSpan().Slice(dstOffset); + Span dstSpan = pd.Dst.Buf.AsSpan().Slice(dstOffset); if (mi.SbType < BlockSize.Block8x8) { @@ -223,7 +223,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 ref MacroBlockDPlane pd = ref xd.Plane[plane]; var sc = Luts.Vp9DefaultScanOrders[(int)txSize]; int eob = Detokenize.DecodeBlockTokens(ref twd, plane, sc, col, row, txSize, mi.SegmentId); - Span dst = pd.Dst.Buf.ToSpan().Slice(4 * row * pd.Dst.Stride + 4 * col); + Span dst = pd.Dst.Buf.AsSpan().Slice(4 * row * pd.Dst.Stride + 4 * col); if (eob > 0) { @@ -922,7 +922,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 BlockSize subsize, int bw) { - Span aboveCtx = twd.Xd.AboveSegContext.Slice(miCol).ToSpan(); + Span aboveCtx = twd.Xd.AboveSegContext.Slice(miCol).AsSpan(); Span leftCtx = MemoryMarshal.CreateSpan(ref twd.Xd.LeftSegContext[miRow & Constants.MiMask], 8 - (miRow & Constants.MiMask)); // Update the partition context at the end notes. Set partition bits @@ -1077,7 +1077,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 errorInfo.InternalError(CodecErr.CodecCorruptFrame, "Truncated packet or corrupt tile length"); } - size = BinaryPrimitives.ReadInt32BigEndian(data.ToSpan()); + size = BinaryPrimitives.ReadInt32BigEndian(data.AsSpan()); data = data.Slice(4); if (size > data.Length) @@ -1250,8 +1250,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 Debug.Assert(tileCols <= (1 << 6)); Debug.Assert(tileRows == 1); - cm.AboveContext.ToSpan().Fill(0); - cm.AboveSegContext.ToSpan().Fill(0); + cm.AboveContext.AsSpan().Fill(0); + cm.AboveSegContext.AsSpan().Fill(0); for (n = 0; n < numWorkers; ++n) { @@ -1266,12 +1266,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 GetTileBuffers(ref cm, data, tileCols, ref tileBuffers); - tileBuffers.ToSpan().Slice(0, tileCols).Sort(CompareTileBuffers); + tileBuffers.AsSpan().Slice(0, tileCols).Sort(CompareTileBuffers); if (numWorkers == tileCols) { TileBuffer largest = tileBuffers[0]; - Span buffers = tileBuffers.ToSpan(); + Span buffers = tileBuffers.AsSpan(); buffers.Slice(1).CopyTo(buffers.Slice(0, tileBuffers.Length - 1)); tileBuffers[tileCols - 1] = largest; } diff --git a/Ryujinx.Graphics.Nvdec.Vp9/DecodeMv.cs b/Ryujinx.Graphics.Nvdec.Vp9/DecodeMv.cs index f7fbec3d5..3281905c1 100644 --- a/Ryujinx.Graphics.Nvdec.Vp9/DecodeMv.cs +++ b/Ryujinx.Graphics.Nvdec.Vp9/DecodeMv.cs @@ -21,7 +21,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].ToSpan()); + PredictionMode yMode = ReadIntraMode(ref r, cm.Fc.Value.YModeProb[sizeGroup].AsSpan()); if (!xd.Counts.IsNull) { ++xd.Counts.Value.YMode[sizeGroup][(int)yMode]; @@ -32,7 +32,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].ToSpan()); + PredictionMode uvMode = ReadIntraMode(ref r, cm.Fc.Value.UvModeProb[yMode].AsSpan()); if (!xd.Counts.IsNull) { ++xd.Counts.Value.UvMode[yMode][(int)uvMode]; @@ -43,7 +43,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].ToSpan()); + int mode = r.ReadTree(Luts.Vp9InterModeTree, cm.Fc.Value.InterModeProb[ctx].AsSpan()); if (!xd.Counts.IsNull) { ++xd.Counts.Value.InterMode[ctx][mode]; @@ -54,16 +54,16 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 private static int ReadSegmentId(ref Reader r, ref Array7 segTreeProbs) { - return r.ReadTree(Luts.Vp9SegmentTree, segTreeProbs.ToSpan()); + return r.ReadTree(Luts.Vp9SegmentTree, segTreeProbs.AsSpan()); } private static ReadOnlySpan GetTxProbs(ref Vp9EntropyProbs fc, TxSize maxTxSize, int ctx) { switch (maxTxSize) { - case TxSize.Tx8x8: return fc.Tx8x8Prob[ctx].ToSpan(); - case TxSize.Tx16x16: return fc.Tx16x16Prob[ctx].ToSpan(); - case TxSize.Tx32x32: return fc.Tx32x32Prob[ctx].ToSpan(); + case TxSize.Tx8x8: return fc.Tx8x8Prob[ctx].AsSpan(); + case TxSize.Tx16x16: return fc.Tx16x16Prob[ctx].AsSpan(); + case TxSize.Tx32x32: return fc.Tx32x32Prob[ctx].AsSpan(); default: Debug.Assert(false, "Invalid maxTxSize."); return ReadOnlySpan.Empty; } } @@ -72,9 +72,9 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 { switch (maxTxSize) { - case TxSize.Tx8x8: return counts.Tx8x8[ctx].ToSpan(); - case TxSize.Tx16x16: return counts.Tx16x16[ctx].ToSpan(); - case TxSize.Tx32x32: return counts.Tx32x32[ctx].ToSpan(); + case TxSize.Tx8x8: return counts.Tx8x8[ctx].AsSpan(); + case TxSize.Tx16x16: return counts.Tx16x16[ctx].AsSpan(); + case TxSize.Tx32x32: return counts.Tx32x32[ctx].AsSpan(); default: Debug.Assert(false, "Invalid maxTxSize."); return Span.Empty; } } @@ -253,7 +253,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].ToSpan()); + MvClassType mvClass = (MvClassType)r.ReadTree(Luts.Vp9MvClassTree, fc.Classes[mvcomp].AsSpan()); bool class0 = mvClass == MvClassType.MvClass0; // Integer part @@ -277,7 +277,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 } // Fractional part - fr = r.ReadTree(Luts.Vp9MvFPTree, class0 ? fc.Class0Fp[mvcomp][d].ToSpan() : fc.Fp[mvcomp].ToSpan()); + fr = r.ReadTree(Luts.Vp9MvFPTree, class0 ? fc.Class0Fp[mvcomp][d].AsSpan() : fc.Fp[mvcomp].AsSpan()); // 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; @@ -295,7 +295,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 Ptr counts, bool allowHP) { - MvJointType jointType = (MvJointType)r.ReadTree(Luts.Vp9MvJointTree, fc.Joints.ToSpan()); + MvJointType jointType = (MvJointType)r.ReadTree(Luts.Vp9MvJointTree, fc.Joints.AsSpan()); bool useHP = allowHP && refr.UseMvHp(); Mv diff = new Mv(); @@ -402,7 +402,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].ToSpan()); + byte type = (byte)r.ReadTree(Luts.Vp9SwitchableInterpTree, cm.Fc.Value.SwitchableInterpProb[ctx].AsSpan()); if (!xd.Counts.IsNull) { ++xd.Counts.Value.SwitchableInterp[ctx][type]; @@ -1060,7 +1060,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].ToSpan(); + return fc.KfYModeProb[(int)above][(int)left].AsSpan(); } private static void ReadIntraFrameModeInfo( @@ -1113,7 +1113,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 break; } - mi.Value.UvMode = ReadIntraMode(ref r, cm.Fc.Value.KfUvModeProb[(int)mi.Value.Mode].ToSpan()); + mi.Value.UvMode = ReadIntraMode(ref r, cm.Fc.Value.KfUvModeProb[(int)mi.Value.Mode].AsSpan()); } private static void CopyRefFramePair(ref Array2 dst, ref Array2 src) diff --git a/Ryujinx.Graphics.Nvdec.Vp9/Detokenize.cs b/Ryujinx.Graphics.Nvdec.Vp9/Detokenize.cs index 7ede6d34c..bde774c8e 100644 --- a/Ryujinx.Graphics.Nvdec.Vp9/Detokenize.cs +++ b/Ryujinx.Graphics.Nvdec.Vp9/Detokenize.cs @@ -236,8 +236,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 ref MacroBlockDPlane pd = ref xd.Plane[plane]; ref Array2 dequant = ref pd.SegDequant[segId]; int eob; - Span a = pd.AboveContext.ToSpan().Slice(x); - Span l = pd.LeftContext.ToSpan().Slice(y); + Span a = pd.AboveContext.AsSpan().Slice(x); + Span l = pd.LeftContext.AsSpan().Slice(y); int ctx; int ctxShiftA = 0; int ctxShiftL = 0; @@ -250,7 +250,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 eob = DecodeCoefs( ref xd, GetPlaneType(plane), - pd.DqCoeff.ToSpan(), + pd.DqCoeff.AsSpan(), txSize, ref dequant, ctx, @@ -266,7 +266,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 eob = DecodeCoefs( ref xd, GetPlaneType(plane), - pd.DqCoeff.ToSpan(), + pd.DqCoeff.AsSpan(), txSize, ref dequant, ctx, @@ -283,7 +283,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 eob = DecodeCoefs( ref xd, GetPlaneType(plane), - pd.DqCoeff.ToSpan(), + pd.DqCoeff.AsSpan(), txSize, ref dequant, ctx, @@ -303,7 +303,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 eob = DecodeCoefs( ref xd, GetPlaneType(plane), - pd.DqCoeff.ToSpan(), + pd.DqCoeff.AsSpan(), txSize, ref dequant, ctx, diff --git a/Ryujinx.Graphics.Nvdec.Vp9/Dsp/Reader.cs b/Ryujinx.Graphics.Nvdec.Vp9/Dsp/Reader.cs index 94aa69793..5d177b409 100644 --- a/Ryujinx.Graphics.Nvdec.Vp9/Dsp/Reader.cs +++ b/Ryujinx.Graphics.Nvdec.Vp9/Dsp/Reader.cs @@ -50,7 +50,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp private void Fill() { - ReadOnlySpan buffer = _buffer.ToSpan(); + ReadOnlySpan buffer = _buffer.AsSpan(); ReadOnlySpan bufferStart = buffer; ulong value = Value; int count = Count; diff --git a/Ryujinx.Graphics.Nvdec.Vp9/LoopFilter.cs b/Ryujinx.Graphics.Nvdec.Vp9/LoopFilter.cs index 13006934e..9ecccc64e 100644 --- a/Ryujinx.Graphics.Nvdec.Vp9/LoopFilter.cs +++ b/Ryujinx.Graphics.Nvdec.Vp9/LoopFilter.cs @@ -359,8 +359,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 blockInsideLimit = 1; } - lfi.Lfthr[lvl].Lim.ToSpan().Fill((byte)blockInsideLimit); - lfi.Lfthr[lvl].Mblim.ToSpan().Fill((byte)(2 * (lvl + 2) + blockInsideLimit)); + lfi.Lfthr[lvl].Lim.AsSpan().Fill((byte)blockInsideLimit); + lfi.Lfthr[lvl].Mblim.AsSpan().Fill((byte)(2 * (lvl + 2) + blockInsideLimit)); } } @@ -395,7 +395,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].ToSpan()).Fill((byte)lvlSeg); + MemoryMarshal.Cast, byte>(lfi.Lvl[segId].AsSpan()).Fill((byte)lvlSeg); } else { diff --git a/Ryujinx.Graphics.Vulkan/NativeArray.cs b/Ryujinx.Graphics.Vulkan/NativeArray.cs index 9d66ce8d7..f74074390 100644 --- a/Ryujinx.Graphics.Vulkan/NativeArray.cs +++ b/Ryujinx.Graphics.Vulkan/NativeArray.cs @@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Vulkan Length = length; } - public Span ToSpan() + public Span AsSpan() { return new Span(Pointer, Length); } diff --git a/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/Ryujinx.Graphics.Vulkan/PipelineBase.cs index 1f0080c45..b66124f5e 100644 --- a/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -582,7 +582,7 @@ namespace Ryujinx.Graphics.Vulkan _newState.PipelineLayout = internalProgram.PipelineLayout; _newState.StagesCount = (uint)stages.Length; - stages.CopyTo(_newState.Stages.ToSpan().Slice(0, stages.Length)); + stages.CopyTo(_newState.Stages.AsSpan().Slice(0, stages.Length)); SignalStateChange(); } @@ -921,7 +921,7 @@ namespace Ryujinx.Graphics.Vulkan protected void UpdatePipelineAttachmentFormats() { - var dstAttachmentFormats = _newState.Internal.AttachmentFormats.ToSpan(); + var dstAttachmentFormats = _newState.Internal.AttachmentFormats.AsSpan(); FramebufferParams.AttachmentFormats.CopyTo(dstAttachmentFormats); int maxAttachmentIndex = FramebufferParams.MaxColorAttachmentIndex + (FramebufferParams.HasDepthStencil ? 1 : 0); diff --git a/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs b/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs index 2553101d7..4f73b17b3 100644 --- a/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs +++ b/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs @@ -117,7 +117,7 @@ namespace Ryujinx.Graphics.Vulkan private void RecordScissor(Vk api, CommandBuffer commandBuffer) { - api.CmdSetScissor(commandBuffer, 0, (uint)ScissorsCount, _scissors.ToSpan()); + api.CmdSetScissor(commandBuffer, 0, (uint)ScissorsCount, _scissors.AsSpan()); } private void RecordStencilMasks(Vk api, CommandBuffer commandBuffer) @@ -132,7 +132,7 @@ namespace Ryujinx.Graphics.Vulkan private void RecordViewport(Vk api, CommandBuffer commandBuffer) { - api.CmdSetViewport(commandBuffer, 0, (uint)ViewportsCount, Viewports.ToSpan()); + api.CmdSetViewport(commandBuffer, 0, (uint)ViewportsCount, Viewports.AsSpan()); } } } diff --git a/Ryujinx.Graphics.Vulkan/PipelineUid.cs b/Ryujinx.Graphics.Vulkan/PipelineUid.cs index e8137559c..8ea52e20d 100644 --- a/Ryujinx.Graphics.Vulkan/PipelineUid.cs +++ b/Ryujinx.Graphics.Vulkan/PipelineUid.cs @@ -52,22 +52,22 @@ namespace Ryujinx.Graphics.Vulkan return false; } - if (!SequenceEqual(VertexAttributeDescriptions.ToSpan(), other.VertexAttributeDescriptions.ToSpan(), VertexAttributeDescriptionsCount)) + if (!SequenceEqual(VertexAttributeDescriptions.AsSpan(), other.VertexAttributeDescriptions.AsSpan(), VertexAttributeDescriptionsCount)) { return false; } - if (!SequenceEqual(VertexBindingDescriptions.ToSpan(), other.VertexBindingDescriptions.ToSpan(), VertexBindingDescriptionsCount)) + if (!SequenceEqual(VertexBindingDescriptions.AsSpan(), other.VertexBindingDescriptions.AsSpan(), VertexBindingDescriptionsCount)) { return false; } - if (!SequenceEqual(ColorBlendAttachmentState.ToSpan(), other.ColorBlendAttachmentState.ToSpan(), ColorBlendAttachmentStateCount)) + if (!SequenceEqual(ColorBlendAttachmentState.AsSpan(), other.ColorBlendAttachmentState.AsSpan(), ColorBlendAttachmentStateCount)) { return false; } - if (!SequenceEqual(AttachmentFormats.ToSpan(), other.AttachmentFormats.ToSpan(), ColorBlendAttachmentStateCount + (HasDepthStencil ? 1u : 0u))) + if (!SequenceEqual(AttachmentFormats.AsSpan(), other.AttachmentFormats.AsSpan(), ColorBlendAttachmentStateCount + (HasDepthStencil ? 1u : 0u))) { return false; } diff --git a/Ryujinx.Graphics.Vulkan/ShaderCollection.cs b/Ryujinx.Graphics.Vulkan/ShaderCollection.cs index 5447b1f56..82866f7b7 100644 --- a/Ryujinx.Graphics.Vulkan/ShaderCollection.cs +++ b/Ryujinx.Graphics.Vulkan/ShaderCollection.cs @@ -245,7 +245,7 @@ namespace Ryujinx.Graphics.Vulkan PipelineState pipeline = _state.ToVulkanPipelineState(_gd); // Copy the shader stage info to the pipeline. - var stages = pipeline.Stages.ToSpan(); + var stages = pipeline.Stages.AsSpan(); for (int i = 0; i < _shaders.Length; i++) { diff --git a/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs b/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs index efb95ea5b..98c413beb 100644 --- a/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs +++ b/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgV7.cs @@ -19,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Applets { private byte element; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref element, 8 * 0x81); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref element, 8 * 0x81); } } #pragma warning restore CS0649 diff --git a/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs b/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs index ec9770094..87417e16f 100644 --- a/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs +++ b/Ryujinx.HLE/HOS/Applets/Controller/ControllerSupportArgVPre7.cs @@ -19,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Applets { private byte element; - public Span ToSpan() => MemoryMarshal.CreateSpan(ref element, 4 * 0x81); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref element, 4 * 0x81); } } #pragma warning restore CS0649 diff --git a/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs b/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs index 6780f8026..0ca901305 100644 --- a/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs +++ b/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs @@ -179,8 +179,8 @@ namespace Ryujinx.HLE.HOS.Applets.Error byte[] messageTextBuffer = new byte[0x800]; byte[] detailsTextBuffer = new byte[0x800]; - applicationErrorArg.MessageText.ToSpan().CopyTo(messageTextBuffer); - applicationErrorArg.DetailsText.ToSpan().CopyTo(detailsTextBuffer); + applicationErrorArg.MessageText.AsSpan().CopyTo(messageTextBuffer); + applicationErrorArg.DetailsText.AsSpan().CopyTo(detailsTextBuffer); string messageText = Encoding.ASCII.GetString(messageTextBuffer.TakeWhile(b => !b.Equals(0)).ToArray()); string detailsText = Encoding.ASCII.GetString(detailsTextBuffer.TakeWhile(b => !b.Equals(0)).ToArray()); diff --git a/Ryujinx.HLE/HOS/Services/Audio/IHardwareOpusDecoderManager.cs b/Ryujinx.HLE/HOS/Services/Audio/IHardwareOpusDecoderManager.cs index 81ea952b5..58680db85 100644 --- a/Ryujinx.HLE/HOS/Services/Audio/IHardwareOpusDecoderManager.cs +++ b/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.ToSpan()).ToArray(); + byte[] mappings = MemoryMarshal.Cast(parameters.ChannelMappings.AsSpan()).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/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs index e417ffd5d..1cf03f5bc 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs @@ -131,7 +131,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator return ResultCode.InvalidArgument; } - // TODO: Service mount the friends:/ system savedata and try to load friend.cache file, returns true if exists, false otherwise. + // TODO: Service mount the friends:/ system savedata and try to load friend.cache file, returns true if exists, false otherwise. // NOTE: If no cache is available, guest then calls nn::friends::EnsureFriendListAvailable, we can avoid that by faking the cache check. context.ResponseData.Write(true); @@ -190,7 +190,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator } context.Device.System.AccountManager.OpenUserOnlinePlay(userId); - + Logger.Stub?.PrintStub(LogClass.ServiceFriend, new { UserId = userId.ToString() }); return ResultCode.Success; @@ -277,7 +277,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator Array16 randomGuid = new Array16(); - Guid.NewGuid().ToByteArray().AsSpan().CopyTo(randomGuid.ToSpan()); + Guid.NewGuid().ToByteArray().AsSpan().CopyTo(randomGuid.AsSpan()); PlayHistoryRegistrationKey playHistoryRegistrationKey = new PlayHistoryRegistrationKey { diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidDevices/KeyboardDevice.cs b/Ryujinx.HLE/HOS/Services/Hid/HidDevices/KeyboardDevice.cs index fa565a7fc..8908b74dc 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/HidDevices/KeyboardDevice.cs +++ b/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.ToSpan()); + keyState.Keys.AsSpan().CopyTo(newState.Keys.RawData.AsSpan()); newState.Modifiers = (KeyboardModifier)keyState.Modifier; lifo.Write(ref newState); diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs b/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs index 528b6dcea..edcc47d83 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs @@ -543,7 +543,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid Attributes = SixAxisSensorAttribute.IsConnected }; - state.Orientation.AsSpan().CopyTo(newState.Direction.ToSpan()); + state.Orientation.AsSpan().CopyTo(newState.Direction.AsSpan()); ref RingLifo lifo = ref GetSixAxisSensorLifo(ref currentNpad, isRightPair); diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs index c29e07693..9dfa677cf 100644 --- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs +++ b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs @@ -628,7 +628,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp Reserved2 = new Array6() }; - Uuid.CopyTo(tagInfo.Uuid.ToSpan()); + Uuid.CopyTo(tagInfo.Uuid.AsSpan()); context.Memory.Write(outputPosition, tagInfo); diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs index 00e35799a..851b67a5b 100644 --- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs +++ b/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() }; - Encoding.ASCII.GetBytes("Ryujinx").CopyTo(registerInfo.Nickname.ToSpan()); + Encoding.ASCII.GetBytes("Ryujinx").CopyTo(registerInfo.Nickname.AsSpan()); return registerInfo; } diff --git a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs index ba91f08cb..e04dd8134 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs +++ b/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); - Encoding.ASCII.GetBytes("RyujinxNetwork").CopyTo(networkProfile.Name.ToSpan()); + Encoding.ASCII.GetBytes("RyujinxNetwork").CopyTo(networkProfile.Name.AsSpan()); context.Memory.Write(networkProfileDataPosition, networkProfile); diff --git a/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSockAddr.cs b/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSockAddr.cs index 916ca2bbc..71926ceba 100644 --- a/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSockAddr.cs +++ b/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSockAddr.cs @@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd public IPEndPoint ToIPEndPoint() { - IPAddress address = new IPAddress(Address.ToSpan()); + IPAddress address = new IPAddress(Address.AsSpan()); int port = (ushort)IPAddress.NetworkToHostOrder((short)Port); return new IPEndPoint(address, port); @@ -31,7 +31,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd Port = (ushort)IPAddress.HostToNetworkOrder((short)endpoint.Port) }; - endpoint.Address.GetAddressBytes().AsSpan().CopyTo(result.Address.ToSpan()); + endpoint.Address.GetAddressBytes().AsSpan().CopyTo(result.Address.AsSpan()); return result; } diff --git a/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfo4.cs b/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfo4.cs index e2041d2e6..6e4d883b1 100644 --- a/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfo4.cs +++ b/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfo4.cs @@ -22,7 +22,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types Port = port; Address = new Array4(); - address.TryWriteBytes(Address.ToSpan(), out _); + address.TryWriteBytes(Address.AsSpan(), out _); } public void ToNetworkOrder() @@ -43,7 +43,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types { if (BitConverter.IsLittleEndian) { - address.ToSpan().Reverse(); + address.AsSpan().Reverse(); } } } diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs index 6cd16f75d..3b13b583a 100644 --- a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs +++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs @@ -1440,7 +1440,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone int timeZoneSize = Math.Min(StringUtils.LengthCstr(timeZoneAbbreviation), 8); - timeZoneAbbreviation[..timeZoneSize].CopyTo(calendarAdditionalInfo.TimezoneName.ToSpan()); + timeZoneAbbreviation[..timeZoneSize].CopyTo(calendarAdditionalInfo.TimezoneName.AsSpan()); } return result; diff --git a/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs index 640e8be4a..885a4cd7c 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs +++ b/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.ToSpan()); + Encoding.ASCII.GetBytes(name).AsSpan().CopyTo(displayInfo.Name.AsSpan()); _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.ToSpan()).Trim('\0') == name); + int displayId = _displayInfo.FindIndex(display => Encoding.ASCII.GetString(display.Name.AsSpan()).Trim('\0') == name); if (displayId == -1) { diff --git a/Spv.Generator/Instruction.cs b/Spv.Generator/Instruction.cs index 922994049..27190f050 100644 --- a/Spv.Generator/Instruction.cs +++ b/Spv.Generator/Instruction.cs @@ -46,7 +46,7 @@ namespace Spv.Generator result += _resultType.WordCount; } - Span operands = _operands.ToSpan(); + Span operands = _operands.AsSpan(); for (int i = 0; i < operands.Length; i++) { result += operands[i].WordCount; @@ -120,7 +120,7 @@ namespace Spv.Generator writer.Write(Id); } - Span operands = _operands.ToSpan(); + Span operands = _operands.AsSpan(); for (int i = 0; i < operands.Length; i++) { operands[i].WriteOperand(writer); @@ -185,8 +185,8 @@ namespace Spv.Generator public bool EqualsContent(Instruction cmpObj) { - Span thisOperands = _operands.ToSpan(); - Span cmpOperands = cmpObj._operands.ToSpan(); + Span thisOperands = _operands.AsSpan(); + Span cmpOperands = cmpObj._operands.AsSpan(); if (thisOperands.Length != cmpOperands.Length) { @@ -211,7 +211,7 @@ namespace Spv.Generator public int GetHashCodeContent() { - return DeterministicHashCode.Combine(_operands.ToSpan()); + return DeterministicHashCode.Combine(_operands.AsSpan()); } public int GetHashCodeResultType() @@ -221,7 +221,7 @@ namespace Spv.Generator public override int GetHashCode() { - return DeterministicHashCode.Combine(Opcode, Id, _resultType, DeterministicHashCode.Combine(_operands.ToSpan())); + return DeterministicHashCode.Combine(Opcode, Id, _resultType, DeterministicHashCode.Combine(_operands.AsSpan())); } public bool Equals(Operand obj) diff --git a/Spv.Generator/InstructionOperands.cs b/Spv.Generator/InstructionOperands.cs index c7170ec1b..a349827a0 100644 --- a/Spv.Generator/InstructionOperands.cs +++ b/Spv.Generator/InstructionOperands.cs @@ -15,7 +15,7 @@ namespace Spv.Generator public Operand Operand5; public Operand[] Overflow; - public Span ToSpan() + public Span AsSpan() { if (Count > InternalCount) {