Fixed accidentally removing DWordSwap on non vc++

This commit is contained in:
Jordan Cristiano 2016-04-24 21:22:26 -04:00
parent 861988e0be
commit 4c5323dc64

View File

@ -59,6 +59,17 @@ inline bool is_little_endian()
#define NORMAL_DENOMINATOR ( (1<<(NORMAL_FRACTIONAL_BITS)) - 1 ) #define NORMAL_DENOMINATOR ( (1<<(NORMAL_FRACTIONAL_BITS)) - 1 )
#define NORMAL_RESOLUTION (1.0/(NORMAL_DENOMINATOR)) #define NORMAL_RESOLUTION (1.0/(NORMAL_DENOMINATOR))
template <typename T>
inline T DWordSwapC( T dw )
{
uint32 temp;
temp = *((uint32 *)&dw) >> 24;
temp |= ((*((uint32 *)&dw) & 0x00FF0000) >> 8);
temp |= ((*((uint32 *)&dw) & 0x0000FF00) << 8);
temp |= ((*((uint32 *)&dw) & 0x000000FF) << 24);
return *((T*)&temp);
}
#if defined( _MSC_VER ) && !defined( PLATFORM_WINDOWS_PC64 ) #if defined( _MSC_VER ) && !defined( PLATFORM_WINDOWS_PC64 )
#define DWordSwap DWordSwapAsm #define DWordSwap DWordSwapAsm
#pragma warning(push) #pragma warning(push)
@ -74,7 +85,7 @@ inline bool is_little_endian()
} }
#pragma warning(pop) #pragma warning(pop)
#else #else
#error write the 64 bit swaps #define DWordSwap DWordSwapC
#endif #endif
inline unsigned long LoadLittleDWord(const unsigned long *base, unsigned int dwordIndex) inline unsigned long LoadLittleDWord(const unsigned long *base, unsigned int dwordIndex)