1 #ifndef BOOST_ENDIAN_DETAIL_ORDER_HPP_INCLUDED 2 #define BOOST_ENDIAN_DETAIL_ORDER_HPP_INCLUDED 3 4 // Copyright 2019 Peter Dimov 5 // 6 // Distributed under the Boost Software License, Version 1.0. 7 // http://www.boost.org/LICENSE_1_0.txt 8 9 #include <boost/core/scoped_enum.hpp> 10 11 #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 12 13 # define BOOST_ENDIAN_NATIVE_ORDER_INITIALIZER little 14 15 #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 16 17 # define BOOST_ENDIAN_NATIVE_ORDER_INITIALIZER big 18 19 #elif defined(__BYTE_ORDER__) && defined(__ORDER_PDP_ENDIAN__) && __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__ 20 21 # error The Boost.Endian library does not support platforms with PDP endianness. 22 23 #elif defined(__LITTLE_ENDIAN__) 24 25 # define BOOST_ENDIAN_NATIVE_ORDER_INITIALIZER little 26 27 #elif defined(__BIG_ENDIAN__) 28 29 # define BOOST_ENDIAN_NATIVE_ORDER_INITIALIZER big 30 31 #elif defined(_MSC_VER) || defined(__i386__) || defined(__x86_64__) 32 33 # define BOOST_ENDIAN_NATIVE_ORDER_INITIALIZER little 34 35 #else 36 37 # error The Boost.Endian library could not determine the endianness of this platform. 38 39 #endif 40 41 namespace boost 42 { 43 namespace endian 44 { 45 BOOST_SCOPED_ENUM_START(order)46BOOST_SCOPED_ENUM_START(order) 47 { 48 big, 49 little, 50 native = BOOST_ENDIAN_NATIVE_ORDER_INITIALIZER 51 52 }; BOOST_SCOPED_ENUM_END 53 54 } // namespace endian 55 } // namespace boost 56 57 #undef BOOST_ENDIAN_NATIVE_ORDER_INITIALIZER 58 59 #endif // BOOST_ENDIAN_DETAIL_ORDER_HPP_INCLUDED 60