2018-08-16 19:47:36 -04:00
|
|
|
|
namespace Ryujinx.HLE.Utilities
|
2018-03-11 21:05:39 -04:00
|
|
|
|
{
|
|
|
|
|
static class EndianSwap
|
|
|
|
|
{
|
2018-12-04 19:52:39 -05:00
|
|
|
|
public static ushort Swap16(ushort Value) => (ushort)(((Value >> 8) & 0xff) | (Value << 8));
|
2018-08-16 19:47:36 -04:00
|
|
|
|
|
2018-12-04 19:52:39 -05:00
|
|
|
|
public static int Swap32(int Value)
|
2018-06-17 22:28:11 -04:00
|
|
|
|
{
|
2018-12-04 19:52:39 -05:00
|
|
|
|
uint UintVal = (uint)Value;
|
2018-06-17 22:28:11 -04:00
|
|
|
|
|
2018-12-04 19:52:39 -05:00
|
|
|
|
return (int)(((UintVal >> 24) & 0x000000ff) |
|
|
|
|
|
((UintVal >> 8) & 0x0000ff00) |
|
|
|
|
|
((UintVal << 8) & 0x00ff0000) |
|
|
|
|
|
((UintVal << 24) & 0xff000000));
|
2018-06-17 22:28:11 -04:00
|
|
|
|
}
|
2018-03-11 21:05:39 -04:00
|
|
|
|
}
|
|
|
|
|
}
|