mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-18 15:36:39 +00:00
22 lines
540 B
C#
22 lines
540 B
C#
|
using System.Numerics;
|
||
|
|
||
|
namespace Ryujinx.HLE.HOS.Kernel.Process
|
||
|
{
|
||
|
static class CapabilityExtensions
|
||
|
{
|
||
|
public static CapabilityType GetCapabilityType(this uint cap)
|
||
|
{
|
||
|
return (CapabilityType)(((cap + 1) & ~cap) - 1);
|
||
|
}
|
||
|
|
||
|
public static uint GetFlag(this CapabilityType type)
|
||
|
{
|
||
|
return (uint)type + 1;
|
||
|
}
|
||
|
|
||
|
public static uint GetId(this CapabilityType type)
|
||
|
{
|
||
|
return (uint)BitOperations.TrailingZeroCount(type.GetFlag());
|
||
|
}
|
||
|
}
|
||
|
}
|