EndianSwap.cs 529 B

1234567891011121314151617
  1. namespace Ryujinx.HLE.OsHle.Utilities
  2. {
  3. static class EndianSwap
  4. {
  5. public static short Swap16(short Value) => (short)(((Value >> 8) & 0xff) | (Value << 8));
  6. public static int Swap32(int Value)
  7. {
  8. uint UintVal = (uint)Value;
  9. return (int)(((UintVal >> 24) & 0x000000ff) |
  10. ((UintVal >> 8) & 0x0000ff00) |
  11. ((UintVal << 8) & 0x00ff0000) |
  12. ((UintVal << 24) & 0xff000000));
  13. }
  14. }
  15. }