[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:
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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__);
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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__))
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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>();
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user