mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-29 09:29:10 +00:00
(svn r3596) -Codechange: [OSX] changed to use Apple's macros instead of OTTD macros for endian conversion
This increases the execution speed a lot since GCC can't detect the OTTD macro as an endian conversion while Apple's code uses the instruction to convert endian instead of a series of instructions to produce the same result Since we don't have that many endian conversions in the game, overall performance should not increase noteworthy
This commit is contained in:
7
stdafx.h
7
stdafx.h
@@ -52,8 +52,15 @@
|
||||
# endif
|
||||
#endif /* __MORPHOS__ */
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "os/macosx/osx_stdafx.h"
|
||||
// make endian swapping use Apple's macros to increase speed
|
||||
#define BSWAP32(x) Endian32_Swap(x)
|
||||
#define BSWAP16(x) Endian16_Swap(x)
|
||||
#else
|
||||
#define BSWAP32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) << 8) & 0xFF0000) | (((x) << 24) & 0xFF000000))
|
||||
#define BSWAP16(x) ((x) >> 8 | (x) << 8)
|
||||
#endif
|
||||
|
||||
// by default we use [] var arrays
|
||||
#define VARARRAY_SIZE
|
||||
|
Reference in New Issue
Block a user