OpenTTD
endian_type.hpp
Go to the documentation of this file.
1 /* $Id: endian_type.hpp 22411 2011-05-02 17:42:12Z rubidium $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #ifndef ENDIAN_TYPE_HPP
13 #define ENDIAN_TYPE_HPP
14 
15 #if defined(ARM) || defined(__arm__) || defined(__alpha__)
16 
17  #define OTTD_ALIGNMENT 1
18 #else
19 
20  #define OTTD_ALIGNMENT 0
21 #endif
22 
24 #define TTD_LITTLE_ENDIAN 0
25 
26 #define TTD_BIG_ENDIAN 1
27 
28 /* Windows has always LITTLE_ENDIAN */
29 #if defined(WIN32) || defined(__OS2__) || defined(WIN64)
30  #define TTD_ENDIAN TTD_LITTLE_ENDIAN
31 #elif !defined(TESTING)
32  /* Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile */
33  #if defined(STRGEN) || defined(SETTINGSGEN)
34  #include "endian_host.h"
35  #else
36  #include "endian_target.h"
37  #endif
38 #endif /* WIN32 || __OS2__ || WIN64 */
39 
40 #endif /* ENDIAN_TYPE_HPP */