From 5f5cfd4a8219f9592002131767db7c014c26d957 Mon Sep 17 00:00:00 2001 From: Ac_K Date: Sun, 17 Jun 2018 06:06:30 +0200 Subject: [PATCH] Add Swap32 --- Ryujinx.HLE/OsHle/Utilities/EndianSwap.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Ryujinx.HLE/OsHle/Utilities/EndianSwap.cs b/Ryujinx.HLE/OsHle/Utilities/EndianSwap.cs index 93fd38c8f2..ef6e549a29 100644 --- a/Ryujinx.HLE/OsHle/Utilities/EndianSwap.cs +++ b/Ryujinx.HLE/OsHle/Utilities/EndianSwap.cs @@ -3,5 +3,14 @@ static class EndianSwap { public static short Swap16(short Value) => (short)(((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)); + } } }