Address gdkchan's comment
This commit is contained in:
parent
d7f3cbc6c8
commit
1f24842755
3 changed files with 17 additions and 17 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue