Skip to content

Latest commit

 

History

History
62 lines (50 loc) · 2.05 KB

SDL_byteorder.h

File metadata and controls

62 lines (50 loc) · 2.05 KB
 
Apr 26, 2001
Apr 26, 2001
1
2
/*
SDL - Simple DirectMedia Layer
Feb 1, 2006
Feb 1, 2006
3
Copyright (C) 1997-2006 Sam Lantinga
Apr 26, 2001
Apr 26, 2001
4
5
This library is free software; you can redistribute it and/or
Feb 1, 2006
Feb 1, 2006
6
modify it under the terms of the GNU Lesser General Public
Apr 26, 2001
Apr 26, 2001
7
License as published by the Free Software Foundation; either
Feb 1, 2006
Feb 1, 2006
8
version 2.1 of the License, or (at your option) any later version.
Apr 26, 2001
Apr 26, 2001
9
10
11
12
This library 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. See the GNU
Feb 1, 2006
Feb 1, 2006
13
Lesser General Public License for more details.
Apr 26, 2001
Apr 26, 2001
14
Feb 1, 2006
Feb 1, 2006
15
16
17
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Apr 26, 2001
Apr 26, 2001
18
19
Sam Lantinga
Dec 14, 2001
Dec 14, 2001
20
slouken@libsdl.org
Apr 26, 2001
Apr 26, 2001
21
22
23
24
25
26
27
28
29
30
31
*/
/* Macros for determining the byte-order of this platform */
#ifndef _SDL_byteorder_h
#define _SDL_byteorder_h
/* The two types of endianness */
#define SDL_LIL_ENDIAN 1234
#define SDL_BIG_ENDIAN 4321
Sep 8, 2005
Sep 8, 2005
32
33
34
35
36
37
38
39
40
41
#ifdef __linux__
# include <endian.h>
# if BYTE_ORDER == LITTLE_ENDIAN
# define SDL_BYTEORDER SDL_LIL_ENDIAN
# else
# define SDL_BYTEORDER SDL_BIG_ENDIAN
# endif
#else
Apr 26, 2001
Apr 26, 2001
42
43
44
45
46
/* Pardon the mess, I'm trying to determine the endianness of this host.
I'm doing it by preprocessor defines rather than some sort of configure
script so that application code can use this too. The "right" way would
be to dynamically generate this file on install, but that's a lot of work.
*/
Nov 12, 2004
Nov 12, 2004
47
48
#if (defined(__i386__) || defined(__i386)) || \
defined(__ia64__) || defined(WIN32) || \
Apr 26, 2001
Apr 26, 2001
49
(defined(__alpha__) || defined(__alpha)) || \
Sep 8, 2005
Sep 8, 2005
50
51
(defined(__arm__) || defined(__thumb__)) || \
(defined(__sh__) || defined(__sh64__)) || \
Apr 26, 2001
Apr 26, 2001
52
(defined(__mips__) && defined(__MIPSEL__)) || \
Nov 23, 2005
Nov 23, 2005
53
54
defined(__SYMBIAN32__) || defined(__x86_64__) || \
defined(__OS2__) || defined(__LITTLE_ENDIAN__)
Apr 26, 2001
Apr 26, 2001
55
56
57
58
59
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#else
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#endif
Sep 8, 2005
Sep 8, 2005
60
61
#endif /* __linux__ */
Apr 26, 2001
Apr 26, 2001
62
#endif /* _SDL_byteorder_h */