1
0
forked from boostorg/core

Compare commits

..

4 Commits

Author SHA1 Message Date
Peter Dimov 6c95750f37 Use BOOST_GCC instead of BOOST_GCC_VERSION 2023-11-30 10:33:08 +02:00
Andrey Semashev a9f1407d84 Added a sanity check to prevent duplicate definition of BOOST_CORE_HAS_BUILTIN_BIT_CAST. 2023-11-25 16:04:12 +03:00
Andrey Semashev db0fd77af1 Added support for __builtin_bswap16. 2023-11-25 16:04:12 +03:00
Andrey Semashev 7cbbb08e7b Use libstdc++11 for clang prior to 16.
Clang prior to version 16 does not support libstdc++13 that is installed
by default in GHA image ubuntu 22.04 in C++20 mode.
2023-11-25 16:04:12 +03:00
2 changed files with 29 additions and 1 deletions
+10
View File
@@ -228,30 +228,40 @@ jobs:
os: ubuntu-22.04 os: ubuntu-22.04
install: install:
- clang-11 - clang-11
- g++-11
gcc_toolchain: 11
- toolset: clang - toolset: clang
compiler: clang++-12 compiler: clang++-12
cxxstd: "03,11,14,17,20,2b" cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04 os: ubuntu-22.04
install: install:
- clang-12 - clang-12
- g++-11
gcc_toolchain: 11
- toolset: clang - toolset: clang
compiler: clang++-13 compiler: clang++-13
cxxstd: "03,11,14,17,20,2b" cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04 os: ubuntu-22.04
install: install:
- clang-13 - clang-13
- g++-11
gcc_toolchain: 11
- toolset: clang - toolset: clang
compiler: clang++-14 compiler: clang++-14
cxxstd: "03,11,14,17,20,2b" cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04 os: ubuntu-22.04
install: install:
- clang-14 - clang-14
- g++-11
gcc_toolchain: 11
- toolset: clang - toolset: clang
compiler: clang++-15 compiler: clang++-15
cxxstd: "03,11,14,17,20,2b" cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04 os: ubuntu-22.04
install: install:
- clang-15 - clang-15
- g++-11
gcc_toolchain: 11
- toolset: clang - toolset: clang
compiler: clang++-15 compiler: clang++-15
cxxstd: "03,11,14,17,20,2b" cxxstd: "03,11,14,17,20,2b"
+19 -1
View File
@@ -47,12 +47,19 @@
# if __has_builtin(__builtin_bit_cast) # if __has_builtin(__builtin_bit_cast)
# define BOOST_CORE_HAS_BUILTIN_BIT_CAST # define BOOST_CORE_HAS_BUILTIN_BIT_CAST
# endif # endif
# if __has_builtin(__builtin_bswap16)
# define BOOST_CORE_HAS_BUILTIN_BSWAP16
# endif
#endif #endif
#if defined(BOOST_MSVC) && BOOST_MSVC >= 1926 #if !defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST) && (defined(BOOST_MSVC) && BOOST_MSVC >= 1926)
# define BOOST_CORE_HAS_BUILTIN_BIT_CAST # define BOOST_CORE_HAS_BUILTIN_BIT_CAST
#endif #endif
#if !defined(BOOST_CORE_HAS_BUILTIN_BSWAP16) && (defined(BOOST_GCC) && BOOST_GCC >= 40800)
# define BOOST_CORE_HAS_BUILTIN_BSWAP16
#endif
namespace boost namespace boost
{ {
namespace core namespace core
@@ -825,11 +832,22 @@ BOOST_CONSTEXPR inline boost::uint8_t byteswap_impl( boost::uint8_t x ) BOOST_NO
return x; return x;
} }
#if defined(BOOST_CORE_HAS_BUILTIN_BSWAP16)
BOOST_CONSTEXPR inline boost::uint16_t byteswap_impl( boost::uint16_t x ) BOOST_NOEXCEPT
{
return __builtin_bswap16( x );
}
#else
BOOST_CONSTEXPR inline boost::uint16_t byteswap_impl( boost::uint16_t x ) BOOST_NOEXCEPT BOOST_CONSTEXPR inline boost::uint16_t byteswap_impl( boost::uint16_t x ) BOOST_NOEXCEPT
{ {
return static_cast<boost::uint16_t>( x << 8 | x >> 8 ); return static_cast<boost::uint16_t>( x << 8 | x >> 8 );
} }
#endif
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
BOOST_CXX14_CONSTEXPR inline boost::uint32_t byteswap_impl( boost::uint32_t x ) BOOST_NOEXCEPT BOOST_CXX14_CONSTEXPR inline boost::uint32_t byteswap_impl( boost::uint32_t x ) BOOST_NOEXCEPT