mirror of
https://github.com/boostorg/endian.git
synced 2025-07-31 04:57:21 +02:00
Work around std::is_integral<__int128> being false for libstdc++
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
#include <boost/endian/detail/integral_by_size.hpp>
|
||||
#include <boost/endian/detail/intrinsic.hpp>
|
||||
#include <boost/endian/detail/is_scoped_enum.hpp>
|
||||
#include <boost/endian/detail/is_integral.hpp>
|
||||
#include <boost/endian/detail/static_assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <type_traits>
|
||||
@ -103,14 +104,14 @@ inline __uint128_t BOOST_ENDIAN_CONSTEXPR endian_reverse_impl( __uint128_t x ) B
|
||||
// is_endian_reversible
|
||||
|
||||
template<class T> struct is_endian_reversible: std::integral_constant<bool,
|
||||
(std::is_integral<T>::value && !std::is_same<T, bool>::value) || is_scoped_enum<T>::value>
|
||||
(is_integral<T>::value && !std::is_same<T, bool>::value) || is_scoped_enum<T>::value>
|
||||
{
|
||||
};
|
||||
|
||||
// is_endian_reversible_inplace
|
||||
|
||||
template<class T> struct is_endian_reversible_inplace: std::integral_constant<bool,
|
||||
std::is_integral<T>::value || std::is_enum<T>::value || std::is_same<T, float>::value || std::is_same<T, double>::value>
|
||||
is_integral<T>::value || std::is_enum<T>::value || std::is_same<T, float>::value || std::is_same<T, double>::value>
|
||||
{
|
||||
};
|
||||
|
||||
|
37
include/boost/endian/detail/is_integral.hpp
Normal file
37
include/boost/endian/detail/is_integral.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef BOOST_ENDIAN_DETAIL_IS_INTEGRAL_HPP_INCLUDED
|
||||
#define BOOST_ENDIAN_DETAIL_IS_INTEGRAL_HPP_INCLUDED
|
||||
|
||||
// Copyright 2023 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace endian
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<class T> struct is_integral: std::is_integral<T>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(__SIZEOF_INT128__)
|
||||
|
||||
template<> struct is_integral<__int128_t>: std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<> struct is_integral<__uint128_t>: std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
} // namespace endian
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ENDIAN_DETAIL_IS_INTEGRAL_HPP_INCLUDED
|
Reference in New Issue
Block a user