1 #pragma once
2 
3 //********************************************************************************************
4 //*
5 //*    This file is part of Egoboo.
6 //*
7 //*    Egoboo is free software: you can redistribute it and/or modify it
8 //*    under the terms of the GNU General Public License as published by
9 //*    the Free Software Foundation, either version 3 of the License, or
10 //*    (at your option) any later version.
11 //*
12 //*    Egoboo is distributed in the hope that it will be useful, but
13 //*    WITHOUT ANY WARRANTY; without even the implied warranty of
14 //*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 //*    General Public License for more details.
16 //*
17 //*    You should have received a copy of the GNU General Public License
18 //*    along with Egoboo.  If not, see <http://www.gnu.org/licenses/>.
19 //*
20 //********************************************************************************************
21 
22 #include "egoboo_typedef.h"
23 #include <SDL_endian.h>
24 
25 #if defined(__cplusplus)
26 extern "C"
27 {
28 #endif
29 
30 #if defined(_APPLE_)
31 #    include <Endian.h>
32 #endif
33 
34 //--------------------------------------------------------------------------------------------
35 // REMAPPING OF SDL MACROS
36 //--------------------------------------------------------------------------------------------
37 
38 /// define a ENDIAN_FLOAT() "function" to work on both big and little endian systems
39 #if SDL_BYTEORDER != SDL_LIL_ENDIAN
40     extern float ENDIAN_FLOAT( float X );
41 #else
42 #    define ENDIAN_FLOAT( X ) ( X )
43 #endif
44 
45 #define ENDIAN_INT08(X) SDL_SwapLE8(X)
46 #define ENDIAN_INT16(X) SDL_SwapLE16(X)
47 #define ENDIAN_INT32(X) SDL_SwapLE32(X)
48 #define ENDIAN_INT64(X) SDL_SwapLE64(X)
49 
50 //--------------------------------------------------------------------------------------------
51 //--------------------------------------------------------------------------------------------
52 
53 #if defined(__cplusplus)
54 }
55 #endif
56 
57 //--------------------------------------------------------------------------------------------
58 //--------------------------------------------------------------------------------------------
59 
60 #define _egoboo_endian_h
61