Address gdkchan's comment

This commit is contained in:
Thog 2019-10-11 03:42:55 +02:00
parent d7f3cbc6c8
commit 1f24842755
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6
3 changed files with 17 additions and 17 deletions

View file

@ -1,5 +1,3 @@
using System;
namespace Ryujinx.Common
{
public static class BitUtils
@ -137,17 +135,5 @@ namespace Ryujinx.Common
return (value >> 32) | (value << 32);
}
public static uint FromBigEndianToPlatformEndian(uint data)
{
uint result = data;
if (BitConverter.IsLittleEndian)
{
result = (uint)EndianSwap.Swap32((int)result);
}
return result;
}
}
}

View file

@ -1,4 +1,6 @@
namespace Ryujinx.Common
using System;
namespace Ryujinx.Common
{
public static class EndianSwap
{
@ -13,5 +15,17 @@
((uintVal << 8) & 0x00ff0000) |
((uintVal << 24) & 0xff000000));
}
public static uint FromBigEndianToPlatformEndian(uint value)
{
uint result = value;
if (BitConverter.IsLittleEndian)
{
result = (uint)EndianSwap.Swap32((int)result);
}
return result;
}
}
}

View file

@ -15,8 +15,8 @@ namespace Ryujinx.HLE.HOS.Services.Audio.Types
{
OpusPacketHeader header = reader.ReadStruct<OpusPacketHeader>();
header.length = BitUtils.FromBigEndianToPlatformEndian(header.length);
header.finalRange = BitUtils.FromBigEndianToPlatformEndian(header.finalRange);
header.length = EndianSwap.FromBigEndianToPlatformEndian(header.length);
header.finalRange = EndianSwap.FromBigEndianToPlatformEndian(header.finalRange);
return header;
}