From c40c3905e2836e8b105406430c33659a84c2e3ca Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Wed, 19 Oct 2022 01:31:34 +0200 Subject: Avoid allocations in .Parse methods (#3760) * Avoid allocations in .Parse methods Use the Span overloads of the Parse methods when possible to avoid string allocations and remove one unnecessarry array allocation * Avoid another string allocation --- Ryujinx.HLE/Loaders/Mods/IPSwitchPatcher.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Ryujinx.HLE/Loaders') diff --git a/Ryujinx.HLE/Loaders/Mods/IPSwitchPatcher.cs b/Ryujinx.HLE/Loaders/Mods/IPSwitchPatcher.cs index 8cc03d05..416fc1b4 100644 --- a/Ryujinx.HLE/Loaders/Mods/IPSwitchPatcher.cs +++ b/Ryujinx.HLE/Loaders/Mods/IPSwitchPatcher.cs @@ -132,7 +132,7 @@ namespace Ryujinx.HLE.Loaders.Mods { if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) { - return int.TryParse(str.Substring(2), System.Globalization.NumberStyles.HexNumber, null, out value); + return int.TryParse(str.AsSpan(2), System.Globalization.NumberStyles.HexNumber, null, out value); } else { -- cgit v1.2.3