# endian_type.hpp

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 #ifndef ENDIAN_TYPE_HPP
    00013 #define ENDIAN_TYPE_HPP
    00014
    00015 #if defined(ARM) || defined(__arm__) || defined(__alpha__)
    00016
    00017   #define OTTD_ALIGNMENT 1
    00018 #else
    00019
    00020   #define OTTD_ALIGNMENT 0
    00021 #endif
    00022
    00024 #define TTD_LITTLE_ENDIAN 0
    00025
    00026 #define TTD_BIG_ENDIAN 1
    00027
    00028 /* Windows has always LITTLE_ENDIAN */
    00029 #if defined(WIN32) || defined(__OS2__) || defined(WIN64)
    00030   #define TTD_ENDIAN TTD_LITTLE_ENDIAN
    00031 #elif !defined(TESTING)
    00032   /* Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile */
    00033   #if defined(STRGEN) || defined(SETTINGSGEN)
    00034     #include "endian_host.h"
    00035   #else
    00036     #include "endian_target.h"
    00037   #endif
    00038 #endif /* WIN32 || __OS2__ || WIN64 */
    00039
    00040 #endif /* ENDIAN_TYPE_HPP */