etcpak: Replace x86-specific _bswap intrinsic with custom byteswap function (which a good compiler should treat identically anyway).

git-svn-id: https://svn.eduke32.com/eduke32@5686 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-03-28 05:15:59 +00:00
parent f07aebfc28
commit b4d59a287d

View file

@ -12,6 +12,11 @@
namespace namespace
{ {
static inline uint32 byteswap(uint32 l)
{
return ((l >> 8u) & 0xff00u) | ((l & 0xff00u) << 8u) | (l << 24u) | (l >> 24u);
}
typedef std::array<uint16, 4> v4i; typedef std::array<uint16, 4> v4i;
void Average( const uint8* data, v4i* a ) void Average( const uint8* data, v4i* a )
@ -361,8 +366,8 @@ std::pair<uint64, uint64> Planar(const uint8* src)
lo |= g_flags[idx]; lo |= g_flags[idx];
uint64 result = static_cast<uint32>(_bswap(lo)); uint64 result = static_cast<uint32>(byteswap(lo));
result |= static_cast<uint64>(static_cast<uint32>(_bswap(hi))) << 32; result |= static_cast<uint64>(static_cast<uint32>(byteswap(hi))) << 32;
return std::make_pair(result, error); return std::make_pair(result, error);
} }