Rename ToSpan to AsSpan (#3556)

This commit is contained in:
gdkchan 2022-08-11 18:07:37 -03:00 committed by GitHub
parent f9661a54d2
commit a5ff0024fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 281 additions and 281 deletions

View file

@ -19,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Applets
{
private byte element;
public Span<byte> ToSpan() => MemoryMarshal.CreateSpan(ref element, 8 * 0x81);
public Span<byte> AsSpan() => MemoryMarshal.CreateSpan(ref element, 8 * 0x81);
}
}
#pragma warning restore CS0649

View file

@ -19,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Applets
{
private byte element;
public Span<byte> ToSpan() => MemoryMarshal.CreateSpan(ref element, 4 * 0x81);
public Span<byte> AsSpan() => MemoryMarshal.CreateSpan(ref element, 4 * 0x81);
}
}
#pragma warning restore CS0649

View file

@ -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());

View file

@ -117,7 +117,7 @@ namespace Ryujinx.HLE.HOS.Services.Audio
OpusMultiStreamParametersEx parameters = context.Memory.Read<OpusMultiStreamParametersEx>(parametersAddress);
byte[] mappings = MemoryMarshal.Cast<uint, byte>(parameters.ChannelMappings.ToSpan()).ToArray();
byte[] mappings = MemoryMarshal.Cast<uint, byte>(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(

View file

@ -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<byte> randomGuid = new Array16<byte>();
Guid.NewGuid().ToByteArray().AsSpan().CopyTo(randomGuid.ToSpan());
Guid.NewGuid().ToByteArray().AsSpan().CopyTo(randomGuid.AsSpan());
PlayHistoryRegistrationKey playHistoryRegistrationKey = new PlayHistoryRegistrationKey
{

View file

@ -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);

View file

@ -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<SixAxisSensorState> lifo = ref GetSixAxisSensorLifo(ref currentNpad, isRightPair);

View file

@ -628,7 +628,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
Reserved2 = new Array6<byte>()
};
Uuid.CopyTo(tagInfo.Uuid.ToSpan());
Uuid.CopyTo(tagInfo.Uuid.AsSpan());
context.Memory.Write(outputPosition, tagInfo);

View file

@ -85,7 +85,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
Reserved1 = new Array64<byte>(),
Reserved2 = new Array58<byte>()
};
Encoding.ASCII.GetBytes("Ryujinx").CopyTo(registerInfo.Nickname.ToSpan());
Encoding.ASCII.GetBytes("Ryujinx").CopyTo(registerInfo.Nickname.AsSpan());
return registerInfo;
}

View file

@ -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);

View file

@ -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;
}

View file

@ -22,7 +22,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types
Port = port;
Address = new Array4<byte>();
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();
}
}
}

View file

@ -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;

View file

@ -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)
{