File indexing completed on 2025-09-17 08:38:57
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_MP_STD_INTEGER_TRAITS_HPP
0008 #define BOOST_MP_STD_INTEGER_TRAITS_HPP
0009
0010 #include <type_traits>
0011 #include <boost/multiprecision/detail/standalone_config.hpp>
0012
0013 namespace boost {
0014 namespace multiprecision {
0015 namespace detail {
0016
0017 template <class T>
0018 struct is_signed : public std::is_signed<T> {};
0019 template <class T>
0020 struct is_unsigned : public std::is_unsigned<T> {};
0021 template <class T>
0022 struct is_integral : public std::is_integral<T> {};
0023 template <class T>
0024 struct is_arithmetic : public std::is_arithmetic<T> {};
0025 template <class T>
0026 struct make_unsigned : public std::make_unsigned<T> {};
0027 template <class T>
0028 struct make_signed : public std::make_signed<T> {};
0029
0030 #if defined(__SIZEOF_FLOAT128__)
0031 template <>
0032 struct is_arithmetic<__float128> : public std::true_type {};
0033 #endif
0034
0035 #ifdef BOOST_HAS_INT128
0036
0037 template <>
0038 struct is_signed<int128_type> : public std::true_type {};
0039 template <>
0040 struct is_signed<uint128_type> : public std::false_type {};
0041 template <>
0042 struct is_unsigned<int128_type> : public std::false_type {};
0043 template <>
0044 struct is_unsigned<uint128_type> : public std::true_type {};
0045 template <>
0046 struct is_integral<int128_type> : public std::true_type {};
0047 template <>
0048 struct is_integral<uint128_type> : public std::true_type {};
0049 template <>
0050 struct is_arithmetic<int128_type> : public std::true_type {};
0051 template <>
0052 struct is_arithmetic<uint128_type> : public std::true_type {};
0053 template <>
0054 struct make_unsigned<int128_type>
0055 {
0056 using type = uint128_type;
0057 };
0058 template <>
0059 struct make_unsigned<uint128_type>
0060 {
0061 using type = uint128_type;
0062 };
0063 template <>
0064 struct make_signed<int128_type>
0065 {
0066 using type = int128_type;
0067 };
0068 template <>
0069 struct make_signed<uint128_type>
0070 {
0071 using type = int128_type;
0072 };
0073
0074 #endif
0075
0076
0077 #if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304L
0078 template <typename T>
0079 BOOST_INLINE_CONSTEXPR bool is_signed_v = is_signed<T>::value;
0080 template <typename T>
0081 BOOST_INLINE_CONSTEXPR bool is_unsigned_v = is_unsigned<T>::value;
0082 template <typename T>
0083 BOOST_INLINE_CONSTEXPR bool is_integral_v = is_integral<T>::value;
0084 template <typename T>
0085 BOOST_INLINE_CONSTEXPR bool is_arithmetic_v = is_arithmetic<T>::value;
0086 #endif
0087
0088 template <typename T>
0089 using make_unsigned_t = typename make_unsigned<T>::type;
0090 template <typename T>
0091 using make_signed_t = typename make_signed<T>::type;
0092
0093 }}}
0094
0095 #endif