| 1 | #ifndef BOOST_CORE_MAX_ALIGN_HPP_INCLUDED |
| 2 | #define BOOST_CORE_MAX_ALIGN_HPP_INCLUDED |
| 3 | |
| 4 | // MS compatible compilers support #pragma once |
| 5 | |
| 6 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
| 7 | # pragma once |
| 8 | #endif |
| 9 | |
| 10 | // Copyright 2023 Peter Dimov |
| 11 | // Distributed under the Boost Software License, Version 1.0. |
| 12 | // https://www.boost.org/LICENSE_1_0.txt |
| 13 | |
| 14 | #include <boost/core/alignof.hpp> |
| 15 | #include <boost/config.hpp> |
| 16 | #include <cstddef> |
| 17 | |
| 18 | // BOOST_CORE_HAS_FLOAT128 |
| 19 | |
| 20 | #if defined(BOOST_HAS_FLOAT128) |
| 21 | |
| 22 | # define BOOST_CORE_HAS_FLOAT128 |
| 23 | |
| 24 | #elif defined(__SIZEOF_FLOAT128__) |
| 25 | |
| 26 | # define BOOST_CORE_HAS_FLOAT128 |
| 27 | |
| 28 | #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 404) && defined(__i386__) |
| 29 | |
| 30 | # define BOOST_CORE_HAS_FLOAT128 |
| 31 | |
| 32 | #endif |
| 33 | |
| 34 | // max_align_t, max_align |
| 35 | |
| 36 | namespace boost |
| 37 | { |
| 38 | namespace core |
| 39 | { |
| 40 | |
| 41 | union max_align_t |
| 42 | { |
| 43 | char c; |
| 44 | short s; |
| 45 | int i; |
| 46 | long l; |
| 47 | |
| 48 | #if !defined(BOOST_NO_LONG_LONG) |
| 49 | |
| 50 | boost::long_long_type ll; |
| 51 | |
| 52 | #endif |
| 53 | |
| 54 | #if defined(BOOST_HAS_INT128) |
| 55 | |
| 56 | boost::int128_type i128; |
| 57 | |
| 58 | #endif |
| 59 | |
| 60 | float f; |
| 61 | double d; |
| 62 | long double ld; |
| 63 | |
| 64 | #if defined(BOOST_CORE_HAS_FLOAT128) |
| 65 | |
| 66 | __float128 f128; |
| 67 | |
| 68 | #endif |
| 69 | |
| 70 | void* p; |
| 71 | void (*pf) (); |
| 72 | |
| 73 | int max_align_t::* pm; |
| 74 | void (max_align_t::*pmf)(); |
| 75 | }; |
| 76 | |
| 77 | BOOST_CONSTEXPR_OR_CONST std::size_t max_align = BOOST_CORE_ALIGNOF( max_align_t ); |
| 78 | |
| 79 | } // namespace core |
| 80 | } // namespace boost |
| 81 | |
| 82 | #endif // #ifndef BOOST_CORE_MAX_ALIGN_HPP_INCLUDED |
| 83 | |