misc: chore: Use collection expressions in HLE project

This commit is contained in:
Evan Husted
2025-01-26 15:43:02 -06:00
parent 3c2f283ec7
commit 70b767ef60
72 changed files with 312 additions and 299 deletions

View File

@@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Ipc
PId = HasPId ? reader.ReadUInt64() : 0;
int toCopySize = (word >> 1) & 0xf;
int[] toCopy = toCopySize == 0 ? Array.Empty<int>() : new int[toCopySize];
int[] toCopy = toCopySize == 0 ? [] : new int[toCopySize];
for (int index = 0; index < toCopy.Length; index++)
{
@@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Ipc
ToCopy = toCopy;
int toMoveSize = (word >> 5) & 0xf;
int[] toMove = toMoveSize == 0 ? Array.Empty<int>() : new int[toMoveSize];
int[] toMove = toMoveSize == 0 ? [] : new int[toMoveSize];
for (int index = 0; index < toMove.Length; index++)
{
@@ -59,12 +59,12 @@ namespace Ryujinx.HLE.HOS.Ipc
public static IpcHandleDesc MakeCopy(params int[] handles)
{
return new IpcHandleDesc(handles, Array.Empty<int>());
return new IpcHandleDesc(handles, []);
}
public static IpcHandleDesc MakeMove(params int[] handles)
{
return new IpcHandleDesc(Array.Empty<int>(), handles);
return new IpcHandleDesc([], handles);
}
public RecyclableMemoryStream GetStream()

View File

@@ -26,13 +26,13 @@ namespace Ryujinx.HLE.HOS.Ipc
public IpcMessage()
{
PtrBuff = new List<IpcPtrBuffDesc>(0);
SendBuff = new List<IpcBuffDesc>(0);
ReceiveBuff = new List<IpcBuffDesc>(0);
ExchangeBuff = new List<IpcBuffDesc>(0);
RecvListBuff = new List<IpcRecvListBuffDesc>(0);
PtrBuff = [];
SendBuff = [];
ReceiveBuff = [];
ExchangeBuff = [];
RecvListBuff = [];
ObjectIds = new List<int>(0);
ObjectIds = [];
}
public IpcMessage(ReadOnlySpan<byte> data, long cmdPtr)
@@ -122,7 +122,7 @@ namespace Ryujinx.HLE.HOS.Ipc
RecvListBuff.Add(new IpcRecvListBuffDesc(reader.ReadUInt64()));
}
ObjectIds = new List<int>(0);
ObjectIds = [];
}
public RecyclableMemoryStream GetStream(long cmdPtr, ulong recvListAddr)