src/stdafx.h
changeset 8132 f4c7a8e4f25a
parent 8126 c96febd50363
child 8209 0bbae499a1a2
equal deleted inserted replaced
8131:160939e24ed3 8132:f4c7a8e4f25a
    87 	#define CLIB_USERGROUP_PROTOS_H
    87 	#define CLIB_USERGROUP_PROTOS_H
    88 #endif /* __MORPHOS__ */
    88 #endif /* __MORPHOS__ */
    89 
    89 
    90 #if defined(__APPLE__)
    90 #if defined(__APPLE__)
    91 	#include "os/macosx/osx_stdafx.h"
    91 	#include "os/macosx/osx_stdafx.h"
    92 	/* Make endian swapping use Apple's macros to increase speed (since it will use hardware swapping if available)
       
    93 	 * Even though they should return uint16 and uint32, we get warnings if we don't cast those (why?) */
       
    94 	#define BSWAP32(x) ((uint32)Endian32_Swap(x))
       
    95 	#define BSWAP16(x) ((uint16)Endian16_Swap(x))
       
    96 #else
       
    97 	#define BSWAP32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) << 8) & 0xFF0000) | (((x) << 24) & 0xFF000000))
       
    98 	#define BSWAP16(x) ((x) >> 8 | (x) << 8)
       
    99 #endif /* __APPLE__ */
    92 #endif /* __APPLE__ */
   100 
    93 
   101 #if defined(PSP)
    94 #if defined(PSP)
   102 	/* PSP can only have 10 file-descriptors open at any given time, but this
    95 	/* PSP can only have 10 file-descriptors open at any given time, but this
   103 	 *  switch only limits reads via the Fio system. So keep 2 fds free for things
    96 	 *  switch only limits reads via the Fio system. So keep 2 fds free for things
   239 		const char *FS2OTTD(const char *name);
   232 		const char *FS2OTTD(const char *name);
   240 		const char *OTTD2FS(const char *name);
   233 		const char *OTTD2FS(const char *name);
   241 	#endif /* WIN32 */
   234 	#endif /* WIN32 */
   242 #endif /* STRGEN */
   235 #endif /* STRGEN */
   243 
   236 
   244 /* Windows has always LITTLE_ENDIAN */
       
   245 #if defined(WIN32) || defined(__OS2__) || defined(WIN64)
       
   246 	#define TTD_LITTLE_ENDIAN
       
   247 #elif defined(TESTING)
       
   248 	/* Do noting  */
       
   249 #else
       
   250 	/* Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile */
       
   251 	#if defined(STRGEN)
       
   252 		#include "endian_host.h"
       
   253 	#else
       
   254 		#include "endian_target.h"
       
   255 	#endif
       
   256 #endif /* WIN32 || __OS2__ || WIN64 */
       
   257 
       
   258 #if defined(WIN32) || defined(WIN64) || defined(__OS2__) && !defined(__INNOTEK_LIBC__)
   237 #if defined(WIN32) || defined(WIN64) || defined(__OS2__) && !defined(__INNOTEK_LIBC__)
   259 	#define PATHSEP "\\"
   238 	#define PATHSEP "\\"
   260 	#define PATHSEPCHAR '\\'
   239 	#define PATHSEPCHAR '\\'
   261 #else
   240 #else
   262 	#define PATHSEP "/"
   241 	#define PATHSEP "/"
   279 	typedef   signed int      int32;
   258 	typedef   signed int      int32;
   280 	typedef unsigned __int64 uint64;
   259 	typedef unsigned __int64 uint64;
   281 	typedef   signed __int64  int64;
   260 	typedef   signed __int64  int64;
   282 #endif
   261 #endif
   283 
   262 
   284 #if defined(ARM) || defined(__arm__) || defined(__alpha__)
       
   285 	#define OTTD_ALIGNMENT
       
   286 #endif
       
   287 
       
   288 /* Setup alignment and conversion macros */
       
   289 #if defined(TTD_BIG_ENDIAN)
       
   290 	#define TO_BE32X(x)  (x)
       
   291 	#define FROM_BE32(x) (x)
       
   292 	#define TO_BE32(x)   (x)
       
   293 	#define FROM_BE16(x) (x)
       
   294 	#define TO_BE16(x)   (x)
       
   295 	#define TO_LE32X(x)  BSWAP32(x)
       
   296 	static inline uint32 FROM_LE32(uint32 x) { return BSWAP32(x); }
       
   297 	static inline uint32 TO_LE32(uint32 x)   { return BSWAP32(x); }
       
   298 	static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); }
       
   299 	static inline uint16 TO_LE16(uint16 x)   { return BSWAP16(x); }
       
   300 #else
       
   301 	#define TO_BE32X(x)  BSWAP32(x)
       
   302 	static inline uint32 FROM_BE32(uint32 x) { return BSWAP32(x); }
       
   303 	static inline uint32 TO_BE32(uint32 x)   { return BSWAP32(x); }
       
   304 	static inline uint16 FROM_BE16(uint16 x) { return BSWAP16(x); }
       
   305 	static inline uint16 TO_BE16(uint16 x)   { return BSWAP16(x); }
       
   306 	#define TO_LE32X(x)  (x)
       
   307 	#define FROM_LE32(x) (x)
       
   308 	#define TO_LE32(x)   (x)
       
   309 	#define FROM_LE16(x) (x)
       
   310 	#define TO_LE16(x)   (x)
       
   311 #endif /* TTD_BIG_ENDIAN */
       
   312 
       
   313 #if !defined(WITH_PERSONAL_DIR)
   263 #if !defined(WITH_PERSONAL_DIR)
   314 	#define PERSONAL_DIR ""
   264 	#define PERSONAL_DIR ""
   315 #endif
   265 #endif
   316 
   266 
   317 /* Compile time assertions */
   267 /* Compile time assertions */