rob@76: /* rob@76: oscpack -- Open Sound Control (OSC) packet manipulation library rob@76: http://www.rossbencina.com/code/oscpack rob@76: rob@76: Copyright (c) 2004-2013 Ross Bencina rob@76: rob@76: Permission is hereby granted, free of charge, to any person obtaining rob@76: a copy of this software and associated documentation files rob@76: (the "Software"), to deal in the Software without restriction, rob@76: including without limitation the rights to use, copy, modify, merge, rob@76: publish, distribute, sublicense, and/or sell copies of the Software, rob@76: and to permit persons to whom the Software is furnished to do so, rob@76: subject to the following conditions: rob@76: rob@76: The above copyright notice and this permission notice shall be rob@76: included in all copies or substantial portions of the Software. rob@76: rob@76: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, rob@76: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF rob@76: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. rob@76: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR rob@76: ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF rob@76: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION rob@76: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. rob@76: */ rob@76: rob@76: /* rob@76: The text above constitutes the entire oscpack license; however, rob@76: the oscpack developer(s) also make the following non-binding requests: rob@76: rob@76: Any person wishing to distribute modifications to the Software is rob@76: requested to send the modifications to the original developer so that rob@76: they can be incorporated into the canonical version. It is also rob@76: requested that these non-binding requests be included whenever the rob@76: above license is reproduced. rob@76: */ rob@76: #ifndef INCLUDED_OSCPACK_OSCHOSTENDIANNESS_H rob@76: #define INCLUDED_OSCPACK_OSCHOSTENDIANNESS_H rob@76: rob@76: /* rob@76: Make sure either OSC_HOST_LITTLE_ENDIAN or OSC_HOST_BIG_ENDIAN is defined rob@76: rob@76: We try to use preprocessor symbols to deduce the host endianness. rob@76: rob@76: Alternatively you can define one of the above symbols from the command line. rob@76: Usually you do this with the -D flag to the compiler. e.g.: rob@76: rob@76: $ g++ -DOSC_HOST_LITTLE_ENDIAN ... rob@76: */ rob@76: rob@76: #if defined(OSC_HOST_LITTLE_ENDIAN) || defined(OSC_HOST_BIG_ENDIAN) rob@76: rob@76: // endianness defined on the command line. nothing to do here. rob@76: rob@76: #elif defined(__WIN32__) || defined(WIN32) || defined(WINCE) rob@76: rob@76: // assume that __WIN32__ is only defined on little endian systems rob@76: rob@76: #define OSC_HOST_LITTLE_ENDIAN 1 rob@76: #undef OSC_HOST_BIG_ENDIAN rob@76: rob@76: #elif defined(__APPLE__) rob@76: rob@76: #if defined(__LITTLE_ENDIAN__) rob@76: rob@76: #define OSC_HOST_LITTLE_ENDIAN 1 rob@76: #undef OSC_HOST_BIG_ENDIAN rob@76: rob@76: #elif defined(__BIG_ENDIAN__) rob@76: rob@76: #define OSC_HOST_BIG_ENDIAN 1 rob@76: #undef OSC_HOST_LITTLE_ENDIAN rob@76: rob@76: #endif rob@76: rob@76: #elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) rob@76: rob@76: // should cover gcc and clang rob@76: rob@76: #if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) rob@76: rob@76: #define OSC_HOST_LITTLE_ENDIAN 1 rob@76: #undef OSC_HOST_BIG_ENDIAN rob@76: rob@76: #elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) rob@76: rob@76: #define OSC_HOST_BIG_ENDIAN 1 rob@76: #undef OSC_HOST_LITTLE_ENDIAN rob@76: rob@76: #endif rob@76: rob@76: #else rob@76: rob@76: // gcc defines __LITTLE_ENDIAN__ and __BIG_ENDIAN__ rob@76: // for others used here see http://sourceforge.net/p/predef/wiki/Endianness/ rob@76: #if (defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) \ rob@76: || (defined(__ARMEL__) && !defined(__ARMEB__)) \ rob@76: || (defined(__AARCH64EL__) && !defined(__AARCH64EB__)) \ rob@76: || (defined(_MIPSEL) && !defined(_MIPSEB)) \ rob@76: || (defined(__MIPSEL) && !defined(__MIPSEB)) \ rob@76: || (defined(__MIPSEL__) && !defined(__MIPSEB__)) rob@76: rob@76: #define OSC_HOST_LITTLE_ENDIAN 1 rob@76: #undef OSC_HOST_BIG_ENDIAN rob@76: rob@76: #elif (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)) \ rob@76: || (defined(__ARMEB__) && !defined(__ARMEL__)) \ rob@76: || (defined(__AARCH64EB__) && !defined(__AARCH64EL__)) \ rob@76: || (defined(_MIPSEB) && !defined(_MIPSEL)) \ rob@76: || (defined(__MIPSEB) && !defined(__MIPSEL)) \ rob@76: || (defined(__MIPSEB__) && !defined(__MIPSEL__)) rob@76: rob@76: #define OSC_HOST_BIG_ENDIAN 1 rob@76: #undef OSC_HOST_LITTLE_ENDIAN rob@76: rob@76: #endif rob@76: rob@76: #endif rob@76: rob@76: #if !defined(OSC_HOST_LITTLE_ENDIAN) && !defined(OSC_HOST_BIG_ENDIAN) rob@76: rob@76: #error please edit OSCHostEndianness.h or define one of {OSC_HOST_LITTLE_ENDIAN, OSC_HOST_BIG_ENDIAN} to configure endianness rob@76: rob@76: #endif rob@76: rob@76: #endif /* INCLUDED_OSCPACK_OSCHOSTENDIANNESS_H */ rob@76: