1////////////////////////////////////////////////////////////////
2// Copyright 2021 Matt Borland. Distributed under the Boost
3// Software License, Version 1.0. (See accompanying file
4// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
5
6#ifndef BOOST_MP_DETAIL_ENDIAN_HPP
7#define BOOST_MP_DETAIL_ENDIAN_HPP
8
9#include <boost/multiprecision/detail/standalone_config.hpp>
10
11#ifndef BOOST_MP_STANDALONE
12
13# include <boost/predef/other/endian.h>
14# define BOOST_MP_ENDIAN_BIG_BYTE BOOST_ENDIAN_BIG_BYTE
15# define BOOST_MP_ENDIAN_LITTLE_BYTE BOOST_ENDIAN_LITTLE_BYTE
16
17#elif defined(_WIN32)
18
19# define BOOST_MP_ENDIAN_BIG_BYTE 0
20# define BOOST_MP_ENDIAN_LITTLE_BYTE 1
21
22#elif defined(__BYTE_ORDER__)
23
24# define BOOST_MP_ENDIAN_BIG_BYTE (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
25# define BOOST_MP_ENDIAN_LITTLE_BYTE (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
26
27#else
28# error Could not determine endian type. Please disable standalone mode, and file an issue at https://github.com/boostorg/multiprecision
29#endif // Determine endianness
30
31static_assert((BOOST_MP_ENDIAN_BIG_BYTE || BOOST_MP_ENDIAN_LITTLE_BYTE)
32 && !(BOOST_MP_ENDIAN_BIG_BYTE && BOOST_MP_ENDIAN_LITTLE_BYTE),
33 "Inconsistent endianness detected. Please disable standalone mode, and file an issue at https://github.com/boostorg/multiprecision");
34
35#endif // BOOST_MP_DETAIL_ENDIAN_HPP
36

source code of boost/libs/multiprecision/include/boost/multiprecision/detail/endian.hpp