diff options
author | glx <glx@openttd.org> | 2011-09-06 00:10:20 +0000 |
---|---|---|
committer | glx <glx@openttd.org> | 2011-09-06 00:10:20 +0000 |
commit | 2c20738067e6cd4f49ce063967c93776b583066a (patch) | |
tree | 24066f046afefa8c61a1ea1724dd162419738310 | |
parent | 29814047938c083417ec4cea0dd8f66bd92ea444 (diff) | |
download | openttd-2c20738067e6cd4f49ce063967c93776b583066a.tar.xz |
(svn r22898) -Codechange: use MSVC compiler intrinsics for byte swapping
-rw-r--r-- | src/core/bitmath_func.hpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/bitmath_func.hpp b/src/core/bitmath_func.hpp index a881ee81d..d10003007 100644 --- a/src/core/bitmath_func.hpp +++ b/src/core/bitmath_func.hpp @@ -355,6 +355,10 @@ static FORCEINLINE T ROR(const T x, const uint8 n) * warnings if we don't cast those (why?) */ #define BSWAP32(x) ((uint32)Endian32_Swap(x)) #define BSWAP16(x) ((uint16)Endian16_Swap(x)) +#elif defined(_MSC_VER) + /* MSVC has intrinsics for swapping, resulting in faster code */ + #define BSWAP32(x) (_byteswap_ulong(x)) + #define BSWAP16(x) (_byteswap_ushort(x)) #else /** * Perform a 32 bits endianness bitswap on x. |