# endian_type.hpp

Go to the documentation of this file.

    00001 /* $Id: endian_type.hpp 17248 2009-08-21 20:21:05Z rubidium $ */
    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   #define OTTD_ALIGNMENT 1
    00017 #else
    00018   #define OTTD_ALIGNMENT 0
    00019 #endif
    00020
    00021 #define TTD_LITTLE_ENDIAN 0
    00022 #define TTD_BIG_ENDIAN 1
    00023
    00024 /* Windows has always LITTLE_ENDIAN */
    00025 #if defined(WIN32) || defined(__OS2__) || defined(WIN64)
    00026   #define TTD_ENDIAN TTD_LITTLE_ENDIAN
    00027 #elif !defined(TESTING)
    00028   /* Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile */
    00029   #if defined(STRGEN)
    00030     #include "endian_host.h"
    00031   #else
    00032     #include "endian_target.h"
    00033   #endif
    00034 #endif /* WIN32 || __OS2__ || WIN64 */
    00035
    00036 #endif /* ENDIAN_TYPE_HPP */