1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-23 09:02:01 +00:00
Ryujinx/Ryujinx.HLE/Utilities/EndianSwap.cs
2018-12-01 14:38:15 -06:00

17 lines
527 B
C#

namespace Ryujinx.HLE.Utilities
{
internal static class EndianSwap
{
public static ushort Swap16(ushort value) => (ushort)(((value >> 8) & 0xff) | (value << 8));
public static int Swap32(int value)
{
uint uintVal = (uint)value;
return (int)(((uintVal >> 24) & 0x000000ff) |
((uintVal >> 8) & 0x0000ff00) |
((uintVal << 8) & 0x00ff0000) |
((uintVal << 24) & 0xff000000));
}
}
}