Replace GetPlatformEndianness() by PlatformEndianness constexpr
from nazarautils
This commit is contained in:
parent
a3bf80a805
commit
21680171a2
|
|
@ -128,7 +128,7 @@ namespace Nz
|
||||||
// Flush bits in case a writing is in progress
|
// Flush bits in case a writing is in progress
|
||||||
context.FlushBits();
|
context.FlushBits();
|
||||||
|
|
||||||
if (context.endianness != Endianness::Unknown && context.endianness != GetPlatformEndianness())
|
if (context.endianness != Endianness::Unknown && context.endianness != PlatformEndianness)
|
||||||
value = ByteSwap(value);
|
value = ByteSwap(value);
|
||||||
|
|
||||||
return context.stream->Write(&value, sizeof(T)) == sizeof(T);
|
return context.stream->Write(&value, sizeof(T)) == sizeof(T);
|
||||||
|
|
@ -207,7 +207,7 @@ namespace Nz
|
||||||
|
|
||||||
if (context.stream->Read(value, sizeof(T)) == sizeof(T))
|
if (context.stream->Read(value, sizeof(T)) == sizeof(T))
|
||||||
{
|
{
|
||||||
if (context.endianness != Endianness::Unknown && context.endianness != GetPlatformEndianness())
|
if (context.endianness != Endianness::Unknown && context.endianness != PlatformEndianness)
|
||||||
*value = ByteSwap(*value);
|
*value = ByteSwap(*value);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ namespace Nz
|
||||||
|
|
||||||
UInt64 ReadOgg(OggVorbis_File* file, void* buffer, UInt64 sampleCount)
|
UInt64 ReadOgg(OggVorbis_File* file, void* buffer, UInt64 sampleCount)
|
||||||
{
|
{
|
||||||
constexpr int bigendian = (GetPlatformEndianness() == Endianness::LittleEndian) ? 0 : 1;
|
constexpr int bigendian = (PlatformEndianness == Endianness::LittleEndian) ? 0 : 1;
|
||||||
|
|
||||||
char* ptr = reinterpret_cast<char*>(buffer);
|
char* ptr = reinterpret_cast<char*>(buffer);
|
||||||
UInt64 remainingBytes = sampleCount * sizeof(Int16);
|
UInt64 remainingBytes = sampleCount * sizeof(Int16);
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ SCENARIO("ByteStream", "[CORE][BYTESTREAM]")
|
||||||
Nz::ByteArray byteArray(numberOfBytes);
|
Nz::ByteArray byteArray(numberOfBytes);
|
||||||
Nz::ByteStream byteStream(&byteArray);
|
Nz::ByteStream byteStream(&byteArray);
|
||||||
|
|
||||||
byteStream.SetDataEndianness(Nz::GetPlatformEndianness() == Nz::Endianness::BigEndian ? Nz::Endianness::LittleEndian : Nz::Endianness::BigEndian);
|
byteStream.SetDataEndianness(Nz::PlatformEndianness == Nz::Endianness::BigEndian ? Nz::Endianness::LittleEndian : Nz::Endianness::BigEndian);
|
||||||
|
|
||||||
WHEN("We write an integer")
|
WHEN("We write an integer")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue