Update for latest nazarautils
This commit is contained in:
@@ -129,7 +129,7 @@ namespace Nz
|
||||
context.FlushBits();
|
||||
|
||||
if (context.endianness != Endianness::Unknown && context.endianness != GetPlatformEndianness())
|
||||
SwapBytes(&value, sizeof(T));
|
||||
value = ByteSwap(value);
|
||||
|
||||
return context.stream->Write(&value, sizeof(T)) == sizeof(T);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ namespace Nz
|
||||
if (context.stream->Read(value, sizeof(T)) == sizeof(T))
|
||||
{
|
||||
if (context.endianness != Endianness::Unknown && context.endianness != GetPlatformEndianness())
|
||||
SwapBytes(value, sizeof(T));
|
||||
*value = ByteSwap(*value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Network/Config.hpp>
|
||||
#include <Nazara/Network/Enums.hpp>
|
||||
#include <functional>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -10,21 +10,13 @@ namespace Nz
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_arithmetic<T>::value, T> HostToNet(T value)
|
||||
{
|
||||
#ifdef NAZARA_LITTLE_ENDIAN
|
||||
return SwapBytes(value);
|
||||
#else
|
||||
return value;
|
||||
#endif
|
||||
return HostToBigEndian(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_arithmetic<T>::value, T> NetToHost(T value)
|
||||
{
|
||||
#ifdef NAZARA_LITTLE_ENDIAN
|
||||
return SwapBytes(value);
|
||||
#else
|
||||
return value;
|
||||
#endif
|
||||
return BigEndianToHost(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user