mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-24 10:47:11 +02:00
UI: Add Skyrim, KAFTL & HW:AOC to RPC.
Minor code improvements and comment fixes.
This commit is contained in:
parent
280b94fc0c
commit
1800ecc1b4
13 changed files with 68 additions and 122 deletions
|
@ -8,7 +8,7 @@ namespace Ryujinx.Common
|
|||
public static class StreamExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Writes a <cref="ReadOnlySpan<int>" /> to this stream.
|
||||
/// Writes a <see cref="ReadOnlySpan{int}" /> to this stream.
|
||||
///
|
||||
/// This default implementation converts each buffer value to a stack-allocated
|
||||
/// byte array, then writes it to the Stream using <cref="System.Stream.Write(byte[])" />.
|
||||
|
@ -66,8 +66,8 @@ namespace Ryujinx.Common
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
// Writes a four-byte unsigned integer to this stream. The current position
|
||||
// of the stream is advanced by four.
|
||||
/// Writes a four-byte unsigned integer to this stream. The current position
|
||||
/// of the stream is advanced by four.
|
||||
/// </summary>
|
||||
/// <param name="stream">The stream to be written to</param>
|
||||
/// <param name="value">The value to be written</param>
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace Ryujinx.Common
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static ulong XorShift64(ulong v64, int shift)
|
||||
{
|
||||
Debug.Assert(0 <= shift && shift < 64);
|
||||
Debug.Assert(shift is >= 0 and < 64);
|
||||
|
||||
return v64 ^ (v64 >> shift);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue