mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-10-04 15:18:54 +02:00
misc: chore: Merge into pattern
This commit is contained in:
@@ -943,7 +943,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
|
||||
{
|
||||
return KernelResult.OutOfResource;
|
||||
}
|
||||
else if (recvListType == 1 || recvListType == 2)
|
||||
else if (recvListType is 1 or 2)
|
||||
{
|
||||
ulong recvListBaseAddr;
|
||||
ulong recvListEndAddr;
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
||||
return KernelResult.InvalidState;
|
||||
}
|
||||
|
||||
Debug.Assert(permission == KMemoryPermission.Read || permission == KMemoryPermission.ReadAndExecute);
|
||||
Debug.Assert(permission is KMemoryPermission.Read or KMemoryPermission.ReadAndExecute);
|
||||
|
||||
Result result = Owner.MemoryManager.MapPages(address, _pageList, MemoryState.CodeReadOnly, permission);
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
|
||||
Pid = KernelContext.NewKipId();
|
||||
|
||||
if (Pid == 0 || Pid >= KernelConstants.InitialProcessId)
|
||||
if (Pid is 0 or >= KernelConstants.InitialProcessId)
|
||||
{
|
||||
throw new InvalidOperationException($"Invalid KIP Id {Pid}.");
|
||||
}
|
||||
@@ -237,7 +237,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
|
||||
Pid = KernelContext.NewProcessId();
|
||||
|
||||
if (Pid == ulong.MaxValue || Pid < KernelConstants.InitialProcessId)
|
||||
if (Pid is ulong.MaxValue or < KernelConstants.InitialProcessId)
|
||||
{
|
||||
throw new InvalidOperationException($"Invalid Process Id {Pid}.");
|
||||
}
|
||||
@@ -897,10 +897,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
{
|
||||
if (State >= ProcessState.Started)
|
||||
{
|
||||
if (State == ProcessState.Started ||
|
||||
State == ProcessState.Crashed ||
|
||||
State == ProcessState.Attached ||
|
||||
State == ProcessState.DebugSuspended)
|
||||
if (State is ProcessState.Started
|
||||
or ProcessState.Crashed
|
||||
or ProcessState.Attached
|
||||
or ProcessState.DebugSuspended)
|
||||
{
|
||||
SetState(ProcessState.Exiting);
|
||||
|
||||
@@ -938,16 +938,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
|
||||
lock (_processLock)
|
||||
{
|
||||
if (State >= ProcessState.Started)
|
||||
if (State is >= ProcessState.Started
|
||||
and (ProcessState.Started or ProcessState.Attached or ProcessState.DebugSuspended))
|
||||
{
|
||||
if (State == ProcessState.Started ||
|
||||
State == ProcessState.Attached ||
|
||||
State == ProcessState.DebugSuspended)
|
||||
{
|
||||
SetState(ProcessState.Exiting);
|
||||
SetState(ProcessState.Exiting);
|
||||
|
||||
shallTerminate = true;
|
||||
}
|
||||
shallTerminate = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1191,7 +1191,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
||||
return KernelResult.InvalidMemState;
|
||||
}
|
||||
|
||||
if (permission > KMemoryPermission.ReadAndWrite || permission == KMemoryPermission.Write)
|
||||
if (permission is > KMemoryPermission.ReadAndWrite or KMemoryPermission.Write)
|
||||
{
|
||||
return KernelResult.InvalidPermission;
|
||||
}
|
||||
@@ -1253,7 +1253,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
||||
return KernelResult.InvalidMemState;
|
||||
}
|
||||
|
||||
if (permission > KMemoryPermission.ReadAndWrite || permission == KMemoryPermission.Write)
|
||||
if (permission is > KMemoryPermission.ReadAndWrite or KMemoryPermission.Write)
|
||||
{
|
||||
return KernelResult.InvalidPermission;
|
||||
}
|
||||
@@ -2126,7 +2126,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
||||
|
||||
case InfoType.ThreadTickCount:
|
||||
{
|
||||
if (subId < -1 || subId > 3)
|
||||
if (subId is < -1 or > 3)
|
||||
{
|
||||
return KernelResult.InvalidCombination;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user