UI: Add Skyrim, KAFTL & HW:AOC to RPC.

Minor code improvements and comment fixes.
This commit is contained in:
Evan Husted
2024-10-16 19:23:11 -05:00
parent 280b94fc0c
commit 1800ecc1b4
13 changed files with 68 additions and 122 deletions

View File

@ -4,23 +4,18 @@ namespace Ryujinx.Common
{
public static class BitUtils
{
public static T AlignUp<T>(T value, T size)
where T : IBinaryInteger<T>
{
return (value + (size - T.One)) & -size;
}
public static T AlignUp<T>(T value, T size) where T : IBinaryInteger<T>
=> (value + (size - T.One)) & -size;
public static T AlignDown<T>(T value, T size)
where T : IBinaryInteger<T>
{
return value & -size;
}
public static T AlignDown<T>(T value, T size) where T : IBinaryInteger<T>
=> value & -size;
public static T DivRoundUp<T>(T value, T dividend)
where T : IBinaryInteger<T>
{
return (value + (dividend - T.One)) / dividend;
}
public static T DivRoundUp<T>(T value, T dividend) where T : IBinaryInteger<T>
=> (value + (dividend - T.One)) / dividend;
public static int Pow2RoundDown(int value) => BitOperations.IsPow2(value) ? value : Pow2RoundUp(value) >> 1;
public static long ReverseBits64(long value) => (long)ReverseBits64((ulong)value);
public static int Pow2RoundUp(int value)
{
@ -35,16 +30,6 @@ namespace Ryujinx.Common
return ++value;
}
public static int Pow2RoundDown(int value)
{
return BitOperations.IsPow2(value) ? value : Pow2RoundUp(value) >> 1;
}
public static long ReverseBits64(long value)
{
return (long)ReverseBits64((ulong)value);
}
private static ulong ReverseBits64(ulong value)
{
value = ((value & 0xaaaaaaaaaaaaaaaa) >> 1) | ((value & 0x5555555555555555) << 1);