rob@76
|
1 /*
|
rob@76
|
2 oscpack -- Open Sound Control (OSC) packet manipulation library
|
rob@76
|
3 http://www.rossbencina.com/code/oscpack
|
rob@76
|
4
|
rob@76
|
5 Copyright (c) 2004-2013 Ross Bencina <rossb@audiomulch.com>
|
rob@76
|
6
|
rob@76
|
7 Permission is hereby granted, free of charge, to any person obtaining
|
rob@76
|
8 a copy of this software and associated documentation files
|
rob@76
|
9 (the "Software"), to deal in the Software without restriction,
|
rob@76
|
10 including without limitation the rights to use, copy, modify, merge,
|
rob@76
|
11 publish, distribute, sublicense, and/or sell copies of the Software,
|
rob@76
|
12 and to permit persons to whom the Software is furnished to do so,
|
rob@76
|
13 subject to the following conditions:
|
rob@76
|
14
|
rob@76
|
15 The above copyright notice and this permission notice shall be
|
rob@76
|
16 included in all copies or substantial portions of the Software.
|
rob@76
|
17
|
rob@76
|
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
rob@76
|
19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
rob@76
|
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
rob@76
|
21 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
rob@76
|
22 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
rob@76
|
23 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
rob@76
|
24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
rob@76
|
25 */
|
rob@76
|
26
|
rob@76
|
27 /*
|
rob@76
|
28 The text above constitutes the entire oscpack license; however,
|
rob@76
|
29 the oscpack developer(s) also make the following non-binding requests:
|
rob@76
|
30
|
rob@76
|
31 Any person wishing to distribute modifications to the Software is
|
rob@76
|
32 requested to send the modifications to the original developer so that
|
rob@76
|
33 they can be incorporated into the canonical version. It is also
|
rob@76
|
34 requested that these non-binding requests be included whenever the
|
rob@76
|
35 above license is reproduced.
|
rob@76
|
36 */
|
rob@76
|
37 #ifndef INCLUDED_OSCPACK_OSCHOSTENDIANNESS_H
|
rob@76
|
38 #define INCLUDED_OSCPACK_OSCHOSTENDIANNESS_H
|
rob@76
|
39
|
rob@76
|
40 /*
|
rob@76
|
41 Make sure either OSC_HOST_LITTLE_ENDIAN or OSC_HOST_BIG_ENDIAN is defined
|
rob@76
|
42
|
rob@76
|
43 We try to use preprocessor symbols to deduce the host endianness.
|
rob@76
|
44
|
rob@76
|
45 Alternatively you can define one of the above symbols from the command line.
|
rob@76
|
46 Usually you do this with the -D flag to the compiler. e.g.:
|
rob@76
|
47
|
rob@76
|
48 $ g++ -DOSC_HOST_LITTLE_ENDIAN ...
|
rob@76
|
49 */
|
rob@76
|
50
|
rob@76
|
51 #if defined(OSC_HOST_LITTLE_ENDIAN) || defined(OSC_HOST_BIG_ENDIAN)
|
rob@76
|
52
|
rob@76
|
53 // endianness defined on the command line. nothing to do here.
|
rob@76
|
54
|
rob@76
|
55 #elif defined(__WIN32__) || defined(WIN32) || defined(WINCE)
|
rob@76
|
56
|
rob@76
|
57 // assume that __WIN32__ is only defined on little endian systems
|
rob@76
|
58
|
rob@76
|
59 #define OSC_HOST_LITTLE_ENDIAN 1
|
rob@76
|
60 #undef OSC_HOST_BIG_ENDIAN
|
rob@76
|
61
|
rob@76
|
62 #elif defined(__APPLE__)
|
rob@76
|
63
|
rob@76
|
64 #if defined(__LITTLE_ENDIAN__)
|
rob@76
|
65
|
rob@76
|
66 #define OSC_HOST_LITTLE_ENDIAN 1
|
rob@76
|
67 #undef OSC_HOST_BIG_ENDIAN
|
rob@76
|
68
|
rob@76
|
69 #elif defined(__BIG_ENDIAN__)
|
rob@76
|
70
|
rob@76
|
71 #define OSC_HOST_BIG_ENDIAN 1
|
rob@76
|
72 #undef OSC_HOST_LITTLE_ENDIAN
|
rob@76
|
73
|
rob@76
|
74 #endif
|
rob@76
|
75
|
rob@76
|
76 #elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__)
|
rob@76
|
77
|
rob@76
|
78 // should cover gcc and clang
|
rob@76
|
79
|
rob@76
|
80 #if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
rob@76
|
81
|
rob@76
|
82 #define OSC_HOST_LITTLE_ENDIAN 1
|
rob@76
|
83 #undef OSC_HOST_BIG_ENDIAN
|
rob@76
|
84
|
rob@76
|
85 #elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
rob@76
|
86
|
rob@76
|
87 #define OSC_HOST_BIG_ENDIAN 1
|
rob@76
|
88 #undef OSC_HOST_LITTLE_ENDIAN
|
rob@76
|
89
|
rob@76
|
90 #endif
|
rob@76
|
91
|
rob@76
|
92 #else
|
rob@76
|
93
|
rob@76
|
94 // gcc defines __LITTLE_ENDIAN__ and __BIG_ENDIAN__
|
rob@76
|
95 // for others used here see http://sourceforge.net/p/predef/wiki/Endianness/
|
rob@76
|
96 #if (defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) \
|
rob@76
|
97 || (defined(__ARMEL__) && !defined(__ARMEB__)) \
|
rob@76
|
98 || (defined(__AARCH64EL__) && !defined(__AARCH64EB__)) \
|
rob@76
|
99 || (defined(_MIPSEL) && !defined(_MIPSEB)) \
|
rob@76
|
100 || (defined(__MIPSEL) && !defined(__MIPSEB)) \
|
rob@76
|
101 || (defined(__MIPSEL__) && !defined(__MIPSEB__))
|
rob@76
|
102
|
rob@76
|
103 #define OSC_HOST_LITTLE_ENDIAN 1
|
rob@76
|
104 #undef OSC_HOST_BIG_ENDIAN
|
rob@76
|
105
|
rob@76
|
106 #elif (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)) \
|
rob@76
|
107 || (defined(__ARMEB__) && !defined(__ARMEL__)) \
|
rob@76
|
108 || (defined(__AARCH64EB__) && !defined(__AARCH64EL__)) \
|
rob@76
|
109 || (defined(_MIPSEB) && !defined(_MIPSEL)) \
|
rob@76
|
110 || (defined(__MIPSEB) && !defined(__MIPSEL)) \
|
rob@76
|
111 || (defined(__MIPSEB__) && !defined(__MIPSEL__))
|
rob@76
|
112
|
rob@76
|
113 #define OSC_HOST_BIG_ENDIAN 1
|
rob@76
|
114 #undef OSC_HOST_LITTLE_ENDIAN
|
rob@76
|
115
|
rob@76
|
116 #endif
|
rob@76
|
117
|
rob@76
|
118 #endif
|
rob@76
|
119
|
rob@76
|
120 #if !defined(OSC_HOST_LITTLE_ENDIAN) && !defined(OSC_HOST_BIG_ENDIAN)
|
rob@76
|
121
|
rob@76
|
122 #error please edit OSCHostEndianness.h or define one of {OSC_HOST_LITTLE_ENDIAN, OSC_HOST_BIG_ENDIAN} to configure endianness
|
rob@76
|
123
|
rob@76
|
124 #endif
|
rob@76
|
125
|
rob@76
|
126 #endif /* INCLUDED_OSCPACK_OSCHOSTENDIANNESS_H */
|
rob@76
|
127
|