[libc++] Teach is_integral, is_[un]signed and make_[un]signed about __[u]int128_t

This commit also adds tests for std::numeric_limits<__[u]int128_t>.

Reviewed in http://llvm-reviews.chandlerc.com/D2917

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@204849 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Stephan Tolksdorf
2014-03-26 19:45:52 +00:00
parent b0767852f7
commit 8a71d23633
41 changed files with 216 additions and 0 deletions

View File

@@ -485,6 +485,10 @@ typedef unsigned short char16_t;
typedef unsigned int char32_t; typedef unsigned int char32_t;
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef __SIZEOF_INT128__
#define _LIBCPP_HAS_NO_INT128
#endif
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT #ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
template <bool> struct __static_assert_test; template <bool> struct __static_assert_test;

View File

@@ -325,6 +325,10 @@ template <> struct __libcpp_is_integral<long> : public tr
template <> struct __libcpp_is_integral<unsigned long> : public true_type {}; template <> struct __libcpp_is_integral<unsigned long> : public true_type {};
template <> struct __libcpp_is_integral<long long> : public true_type {}; template <> struct __libcpp_is_integral<long long> : public true_type {};
template <> struct __libcpp_is_integral<unsigned long long> : public true_type {}; template <> struct __libcpp_is_integral<unsigned long long> : public true_type {};
#ifndef _LIBCPP_HAS_NO_INT128
template <> struct __libcpp_is_integral<__int128_t> : public true_type {};
template <> struct __libcpp_is_integral<__uint128_t> : public true_type {};
#endif
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral
: public __libcpp_is_integral<typename remove_cv<_Tp>::type> {}; : public __libcpp_is_integral<typename remove_cv<_Tp>::type> {};
@@ -1247,7 +1251,13 @@ typedef
__type_list<signed int, __type_list<signed int,
__type_list<signed long, __type_list<signed long,
__type_list<signed long long, __type_list<signed long long,
#ifndef _LIBCPP_HAS_NO_INT128
__type_list<__int128_t,
#endif
__nat __nat
#ifndef _LIBCPP_HAS_NO_INT128
>
#endif
> > > > > __signed_types; > > > > > __signed_types;
typedef typedef
@@ -1256,7 +1266,13 @@ typedef
__type_list<unsigned int, __type_list<unsigned int,
__type_list<unsigned long, __type_list<unsigned long,
__type_list<unsigned long long, __type_list<unsigned long long,
#ifndef _LIBCPP_HAS_NO_INT128
__type_list<__uint128_t,
#endif
__nat __nat
#ifndef _LIBCPP_HAS_NO_INT128
>
#endif
> > > > > __unsigned_types; > > > > > __unsigned_types;
template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first; template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first;
@@ -1340,6 +1356,10 @@ template <> struct __make_signed< signed long, true> {typedef long ty
template <> struct __make_signed<unsigned long, true> {typedef long type;}; template <> struct __make_signed<unsigned long, true> {typedef long type;};
template <> struct __make_signed< signed long long, true> {typedef long long type;}; template <> struct __make_signed< signed long long, true> {typedef long long type;};
template <> struct __make_signed<unsigned long long, true> {typedef long long type;}; template <> struct __make_signed<unsigned long long, true> {typedef long long type;};
#ifndef _LIBCPP_HAS_NO_INT128
template <> struct __make_signed<__int128_t, true> {typedef __int128_t type;};
template <> struct __make_signed<__uint128_t, true> {typedef __int128_t type;};
#endif
template <class _Tp> template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY make_signed struct _LIBCPP_TYPE_VIS_ONLY make_signed
@@ -1369,6 +1389,10 @@ template <> struct __make_unsigned< signed long, true> {typedef unsigned l
template <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;}; template <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;};
template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;};
template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;}; template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;};
#ifndef _LIBCPP_HAS_NO_INT128
template <> struct __make_unsigned<__int128_t, true> {typedef __uint128_t type;};
template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_t type;};
#endif
template <class _Tp> template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY make_unsigned struct _LIBCPP_TYPE_VIS_ONLY make_unsigned

View File

@@ -59,6 +59,10 @@ int main()
test<unsigned long>(); test<unsigned long>();
test<signed long long>(); test<signed long long>();
test<unsigned long long>(); test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t>();
test<__uint128_t>();
#endif
test<float>(); test<float>();
test<double>(); test<double>();
test<long double>(); test<long double>();

View File

@@ -129,6 +129,13 @@ int main()
TEST_NUMERIC_LIMITS(volatile long) TEST_NUMERIC_LIMITS(volatile long)
TEST_NUMERIC_LIMITS(const volatile long) TEST_NUMERIC_LIMITS(const volatile long)
#ifndef _LIBCPP_HAS_NO_INT128
TEST_NUMERIC_LIMITS(__int128_t)
TEST_NUMERIC_LIMITS(const __int128_t)
TEST_NUMERIC_LIMITS(volatile __int128_t)
TEST_NUMERIC_LIMITS(const volatile __int128_t)
#endif
// long long // long long
TEST_NUMERIC_LIMITS(long long) TEST_NUMERIC_LIMITS(long long)
TEST_NUMERIC_LIMITS(const long long) TEST_NUMERIC_LIMITS(const long long)
@@ -159,6 +166,13 @@ int main()
TEST_NUMERIC_LIMITS(volatile unsigned long long) TEST_NUMERIC_LIMITS(volatile unsigned long long)
TEST_NUMERIC_LIMITS(const volatile unsigned long long) TEST_NUMERIC_LIMITS(const volatile unsigned long long)
#ifndef _LIBCPP_HAS_NO_INT128
TEST_NUMERIC_LIMITS(__uint128_t)
TEST_NUMERIC_LIMITS(const __uint128_t)
TEST_NUMERIC_LIMITS(volatile __uint128_t)
TEST_NUMERIC_LIMITS(const volatile __uint128_t)
#endif
// float // float
TEST_NUMERIC_LIMITS(float) TEST_NUMERIC_LIMITS(float)
TEST_NUMERIC_LIMITS(const float) TEST_NUMERIC_LIMITS(const float)

View File

@@ -43,6 +43,10 @@ int main()
test<unsigned long>(0); test<unsigned long>(0);
test<long long>(0); test<long long>(0);
test<unsigned long long>(0); test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t>(0);
test<__uint128_t>(0);
#endif
test<float>(__FLT_DENORM_MIN__); test<float>(__FLT_DENORM_MIN__);
test<double>(__DBL_DENORM_MIN__); test<double>(__DBL_DENORM_MIN__);
test<long double>(__LDBL_DENORM_MIN__); test<long double>(__LDBL_DENORM_MIN__);

View File

@@ -43,6 +43,10 @@ int main()
test<unsigned long, sizeof(long) == 4 ? 32 : 64>(); test<unsigned long, sizeof(long) == 4 ? 32 : 64>();
test<long long, 63>(); test<long long, 63>();
test<unsigned long long, 64>(); test<unsigned long long, 64>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, 127>();
test<__uint128_t, 128>();
#endif
test<float, FLT_MANT_DIG>(); test<float, FLT_MANT_DIG>();
test<double, DBL_MANT_DIG>(); test<double, DBL_MANT_DIG>();
test<long double, LDBL_MANT_DIG>(); test<long double, LDBL_MANT_DIG>();

View File

@@ -47,6 +47,10 @@ int main()
test<unsigned long, sizeof(long) == 4 ? 9 : 19>(); test<unsigned long, sizeof(long) == 4 ? 9 : 19>();
test<long long, 18>(); test<long long, 18>();
test<unsigned long long, 19>(); test<unsigned long long, 19>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, 38>();
test<__uint128_t, 38>();
#endif
test<float, FLT_DIG>(); test<float, FLT_DIG>();
test<double, DBL_DIG>(); test<double, DBL_DIG>();
test<long double, LDBL_DIG>(); test<long double, LDBL_DIG>();

View File

@@ -44,6 +44,10 @@ int main()
test<unsigned long>(0); test<unsigned long>(0);
test<long long>(0); test<long long>(0);
test<unsigned long long>(0); test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t>(0);
test<__uint128_t>(0);
#endif
test<float>(FLT_EPSILON); test<float>(FLT_EPSILON);
test<double>(DBL_EPSILON); test<double>(DBL_EPSILON);
test<long double>(LDBL_EPSILON); test<long double>(LDBL_EPSILON);

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, std::denorm_absent>(); test<unsigned long, std::denorm_absent>();
test<long long, std::denorm_absent>(); test<long long, std::denorm_absent>();
test<unsigned long long, std::denorm_absent>(); test<unsigned long long, std::denorm_absent>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, std::denorm_absent>();
test<__uint128_t, std::denorm_absent>();
#endif
test<float, std::denorm_present>(); test<float, std::denorm_present>();
test<double, std::denorm_present>(); test<double, std::denorm_present>();
test<long double, std::denorm_present>(); test<long double, std::denorm_present>();

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, false>(); test<unsigned long, false>();
test<long long, false>(); test<long long, false>();
test<unsigned long long, false>(); test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif
test<float, false>(); test<float, false>();
test<double, false>(); test<double, false>();
test<long double, false>(); test<long double, false>();

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, false>(); test<unsigned long, false>();
test<long long, false>(); test<long long, false>();
test<unsigned long long, false>(); test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif
test<float, true>(); test<float, true>();
test<double, true>(); test<double, true>();
test<long double, true>(); test<long double, true>();

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, false>(); test<unsigned long, false>();
test<long long, false>(); test<long long, false>();
test<unsigned long long, false>(); test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif
test<float, true>(); test<float, true>();
test<double, true>(); test<double, true>();
test<long double, true>(); test<long double, true>();

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, false>(); test<unsigned long, false>();
test<long long, false>(); test<long long, false>();
test<unsigned long long, false>(); test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif
test<float, true>(); test<float, true>();
test<double, true>(); test<double, true>();
test<long double, true>(); test<long double, true>();

View File

@@ -46,6 +46,10 @@ int main()
test<unsigned long>(0); test<unsigned long>(0);
test<long long>(0); test<long long>(0);
test<unsigned long long>(0); test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t>(0);
test<__uint128_t>(0);
#endif
test<float>(1./zero); test<float>(1./zero);
test<double>(1./zero); test<double>(1./zero);
test<long double>(1./zero); test<long double>(1./zero);

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, true>(); test<unsigned long, true>();
test<long long, true>(); test<long long, true>();
test<unsigned long long, true>(); test<unsigned long long, true>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, true>();
test<__uint128_t, true>();
#endif
test<float, true>(); test<float, true>();
test<double, true>(); test<double, true>();
test<long double, true>(); test<long double, true>();

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, true>(); test<unsigned long, true>();
test<long long, true>(); test<long long, true>();
test<unsigned long long, true>(); test<unsigned long long, true>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, true>();
test<__uint128_t, true>();
#endif
test<float, false>(); test<float, false>();
test<double, false>(); test<double, false>();
test<long double, false>(); test<long double, false>();

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, false>(); test<unsigned long, false>();
test<long long, false>(); test<long long, false>();
test<unsigned long long, false>(); test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif
test<float, true>(); test<float, true>();
test<double, true>(); test<double, true>();
#if (defined(__ppc__) || defined(__ppc64__)) #if (defined(__ppc__) || defined(__ppc64__))

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, true>(); test<unsigned long, true>();
test<long long, true>(); test<long long, true>();
test<unsigned long long, true>(); test<unsigned long long, true>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, true>();
test<__uint128_t, true>();
#endif
test<float, false>(); test<float, false>();
test<double, false>(); test<double, false>();
test<long double, false>(); test<long double, false>();

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, true>(); test<unsigned long, true>();
test<long long, true>(); test<long long, true>();
test<unsigned long long, true>(); test<unsigned long long, true>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, true>();
test<__uint128_t, true>();
#endif
test<float, false>(); test<float, false>();
test<double, false>(); test<double, false>();
test<long double, false>(); test<long double, false>();

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, false>(); test<unsigned long, false>();
test<long long, true>(); test<long long, true>();
test<unsigned long long, false>(); test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, true>();
test<__uint128_t, false>();
#endif
test<float, true>(); test<float, true>();
test<double, true>(); test<double, true>();
test<long double, true>(); test<long double, true>();

View File

@@ -50,6 +50,10 @@ int main()
test<unsigned long>(0); test<unsigned long>(0);
test<long long>(LLONG_MIN); test<long long>(LLONG_MIN);
test<unsigned long long>(0); test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t>(-__int128_t(__uint128_t(-1)/2) - 1);
test<__uint128_t>(0);
#endif
test<float>(-FLT_MAX); test<float>(-FLT_MAX);
test<double>(-DBL_MAX); test<double>(-DBL_MAX);
test<long double>(-LDBL_MAX); test<long double>(-LDBL_MAX);

View File

@@ -50,6 +50,10 @@ int main()
test<unsigned long>(ULONG_MAX); test<unsigned long>(ULONG_MAX);
test<long long>(LLONG_MAX); test<long long>(LLONG_MAX);
test<unsigned long long>(ULLONG_MAX); test<unsigned long long>(ULLONG_MAX);
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t>(__int128_t(__uint128_t(-1)/2));
test<__uint128_t>(__uint128_t(-1));
#endif
test<float>(FLT_MAX); test<float>(FLT_MAX);
test<double>(DBL_MAX); test<double>(DBL_MAX);
test<long double>(LDBL_MAX); test<long double>(LDBL_MAX);

View File

@@ -43,6 +43,10 @@ int main()
test<unsigned long, 0>(); test<unsigned long, 0>();
test<long long, 0>(); test<long long, 0>();
test<unsigned long long, 0>(); test<unsigned long long, 0>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, 0>();
test<__uint128_t, 0>();
#endif
test<float, 2+(FLT_MANT_DIG * 30103)/100000>(); test<float, 2+(FLT_MANT_DIG * 30103)/100000>();
test<double, 2+(DBL_MANT_DIG * 30103)/100000>(); test<double, 2+(DBL_MANT_DIG * 30103)/100000>();
test<long double, 2+(LDBL_MANT_DIG * 30103)/100000>(); test<long double, 2+(LDBL_MANT_DIG * 30103)/100000>();

View File

@@ -43,6 +43,10 @@ int main()
test<unsigned long, 0>(); test<unsigned long, 0>();
test<long long, 0>(); test<long long, 0>();
test<unsigned long long, 0>(); test<unsigned long long, 0>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, 0>();
test<__uint128_t, 0>();
#endif
test<float, FLT_MAX_EXP>(); test<float, FLT_MAX_EXP>();
test<double, DBL_MAX_EXP>(); test<double, DBL_MAX_EXP>();
test<long double, LDBL_MAX_EXP>(); test<long double, LDBL_MAX_EXP>();

View File

@@ -43,6 +43,10 @@ int main()
test<unsigned long, 0>(); test<unsigned long, 0>();
test<long long, 0>(); test<long long, 0>();
test<unsigned long long, 0>(); test<unsigned long long, 0>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, 0>();
test<__uint128_t, 0>();
#endif
test<float, FLT_MAX_10_EXP>(); test<float, FLT_MAX_10_EXP>();
test<double, DBL_MAX_10_EXP>(); test<double, DBL_MAX_10_EXP>();
test<long double, LDBL_MAX_10_EXP>(); test<long double, LDBL_MAX_10_EXP>();

View File

@@ -50,6 +50,10 @@ int main()
test<unsigned long>(0); test<unsigned long>(0);
test<long long>(LLONG_MIN); test<long long>(LLONG_MIN);
test<unsigned long long>(0); test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t>(-__int128_t(__uint128_t(-1)/2) - 1);
test<__uint128_t>(0);
#endif
test<float>(FLT_MIN); test<float>(FLT_MIN);
test<double>(DBL_MIN); test<double>(DBL_MIN);
test<long double>(LDBL_MIN); test<long double>(LDBL_MIN);

View File

@@ -43,6 +43,10 @@ int main()
test<unsigned long, 0>(); test<unsigned long, 0>();
test<long long, 0>(); test<long long, 0>();
test<unsigned long long, 0>(); test<unsigned long long, 0>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, 0>();
test<__uint128_t, 0>();
#endif
test<float, FLT_MIN_EXP>(); test<float, FLT_MIN_EXP>();
test<double, DBL_MIN_EXP>(); test<double, DBL_MIN_EXP>();
test<long double, LDBL_MIN_EXP>(); test<long double, LDBL_MIN_EXP>();

View File

@@ -43,6 +43,10 @@ int main()
test<unsigned long, 0>(); test<unsigned long, 0>();
test<long long, 0>(); test<long long, 0>();
test<unsigned long long, 0>(); test<unsigned long long, 0>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, 0>();
test<__uint128_t, 0>();
#endif
test<float, FLT_MIN_10_EXP>(); test<float, FLT_MIN_10_EXP>();
test<double, DBL_MIN_10_EXP>(); test<double, DBL_MIN_10_EXP>();
test<long double, LDBL_MIN_10_EXP>(); test<long double, LDBL_MIN_10_EXP>();

View File

@@ -63,6 +63,10 @@ int main()
test<unsigned long>(); test<unsigned long>();
test<long long>(); test<long long>();
test<unsigned long long>(); test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t>();
test<__uint128_t>();
#endif
test<float>(); test<float>();
test<double>(); test<double>();
test<long double>(); test<long double>();

View File

@@ -43,6 +43,10 @@ int main()
test<unsigned long, 2>(); test<unsigned long, 2>();
test<long long, 2>(); test<long long, 2>();
test<unsigned long long, 2>(); test<unsigned long long, 2>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, 2>();
test<__uint128_t, 2>();
#endif
test<float, FLT_RADIX>(); test<float, FLT_RADIX>();
test<double, FLT_RADIX>(); test<double, FLT_RADIX>();
test<long double, FLT_RADIX>(); test<long double, FLT_RADIX>();

View File

@@ -44,6 +44,10 @@ int main()
test<unsigned long>(0); test<unsigned long>(0);
test<long long>(0); test<long long>(0);
test<unsigned long long>(0); test<unsigned long long>(0);
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t>(0);
test<__uint128_t>(0);
#endif
test<float>(0.5); test<float>(0.5);
test<double>(0.5); test<double>(0.5);
test<long double>(0.5); test<long double>(0.5);

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, std::round_toward_zero>(); test<unsigned long, std::round_toward_zero>();
test<long long, std::round_toward_zero>(); test<long long, std::round_toward_zero>();
test<unsigned long long, std::round_toward_zero>(); test<unsigned long long, std::round_toward_zero>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, std::round_toward_zero>();
test<__uint128_t, std::round_toward_zero>();
#endif
test<float, std::round_to_nearest>(); test<float, std::round_to_nearest>();
test<double, std::round_to_nearest>(); test<double, std::round_to_nearest>();
test<long double, std::round_to_nearest>(); test<long double, std::round_to_nearest>();

View File

@@ -63,6 +63,10 @@ int main()
test<unsigned long>(); test<unsigned long>();
test<long long>(); test<long long>();
test<unsigned long long>(); test<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t>();
test<__uint128_t>();
#endif
test<float>(); test<float>();
test<double>(); test<double>();
test<long double>(); test<long double>();

View File

@@ -42,6 +42,10 @@ int main()
test<unsigned long, false>(); test<unsigned long, false>();
test<long long, false>(); test<long long, false>();
test<unsigned long long, false>(); test<unsigned long long, false>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, false>();
test<__uint128_t, false>();
#endif
test<float, false>(); test<float, false>();
test<double, false>(); test<double, false>();
test<long double, false>(); test<long double, false>();

View File

@@ -48,6 +48,10 @@ int main()
test<unsigned long, integral_types_trap>(); test<unsigned long, integral_types_trap>();
test<long long, integral_types_trap>(); test<long long, integral_types_trap>();
test<unsigned long long, integral_types_trap>(); test<unsigned long long, integral_types_trap>();
#ifndef _LIBCPP_HAS_NO_INT128
test<__int128_t, integral_types_trap>();
test<__uint128_t, integral_types_trap>();
#endif
test<float, false>(); test<float, false>();
test<double, false>(); test<double, false>();
test<long double, false>(); test<long double, false>();

View File

@@ -21,6 +21,13 @@ enum BigEnum
big = 0xFFFFFFFFFFFFFFFFULL big = 0xFFFFFFFFFFFFFFFFULL
}; };
#if !defined(_LIBCPP_HAS_NO_INT128) && !defined(_LIBCPP_HAS_NO_STRONG_ENUMS)
enum HugeEnum : __uint128_t
{
hugezero
};
#endif
template <class T, class U> template <class T, class U>
void test_make_signed() void test_make_signed()
{ {
@@ -47,4 +54,11 @@ int main()
test_make_signed< const wchar_t, std::conditional<sizeof(wchar_t) == 4, const int, const short>::type >(); test_make_signed< const wchar_t, std::conditional<sizeof(wchar_t) == 4, const int, const short>::type >();
test_make_signed< const Enum, const int >(); test_make_signed< const Enum, const int >();
test_make_signed< BigEnum, std::conditional<sizeof(long) == 4, long long, long>::type >(); test_make_signed< BigEnum, std::conditional<sizeof(long) == 4, long long, long>::type >();
#ifndef _LIBCPP_HAS_NO_INT128
test_make_signed< __int128_t, __int128_t >();
test_make_signed< __uint128_t, __int128_t >();
# ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
test_make_signed< HugeEnum, __int128_t >();
# endif
#endif
} }

View File

@@ -21,6 +21,13 @@ enum BigEnum
big = 0xFFFFFFFFFFFFFFFFULL big = 0xFFFFFFFFFFFFFFFFULL
}; };
#if !defined(_LIBCPP_HAS_NO_INT128) && !defined(_LIBCPP_HAS_NO_STRONG_ENUMS)
enum HugeEnum : __int128_t
{
hugezero
};
#endif
template <class T, class U> template <class T, class U>
void test_make_unsigned() void test_make_unsigned()
{ {
@@ -48,4 +55,11 @@ int main()
test_make_unsigned<const Enum, const unsigned int> (); test_make_unsigned<const Enum, const unsigned int> ();
test_make_unsigned<BigEnum, test_make_unsigned<BigEnum,
std::conditional<sizeof(long) == 4, unsigned long long, unsigned long>::type> (); std::conditional<sizeof(long) == 4, unsigned long long, unsigned long>::type> ();
#ifndef _LIBCPP_HAS_NO_INT128
test_make_unsigned<__int128_t, __uint128_t>();
test_make_unsigned<__uint128_t, __uint128_t>();
# ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
test_make_unsigned<HugeEnum, __uint128_t>();
# endif
#endif
} }

View File

@@ -58,4 +58,8 @@ int main()
test_integral<unsigned long>(); test_integral<unsigned long>();
test_integral<long long>(); test_integral<long long>();
test_integral<unsigned long long>(); test_integral<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
test_integral<__int128_t>();
test_integral<__uint128_t>();
#endif
} }

View File

@@ -49,4 +49,8 @@ int main()
test_integral<unsigned long>(); test_integral<unsigned long>();
test_integral<long long>(); test_integral<long long>();
test_integral<unsigned long long>(); test_integral<unsigned long long>();
#ifndef _LIBCPP_HAS_NO_INT128
test_integral<__int128_t>();
test_integral<__uint128_t>();
#endif
} }

View File

@@ -51,4 +51,9 @@ int main()
test_is_signed<int>(); test_is_signed<int>();
test_is_signed<double>(); test_is_signed<double>();
#ifndef _LIBCPP_HAS_NO_INT128
test_is_signed<__int128_t>();
test_is_not_signed<__uint128_t>();
#endif
} }

View File

@@ -51,4 +51,9 @@ int main()
test_is_unsigned<bool>(); test_is_unsigned<bool>();
test_is_unsigned<unsigned>(); test_is_unsigned<unsigned>();
#ifndef _LIBCPP_HAS_NO_INT128
test_is_unsigned<__uint128_t>();
test_is_not_unsigned<__int128_t>();
#endif
} }