Skip to content

Commit f3589d2

Browse files
committed
[libc++][NFC] Refactor the enable_ifs in the math headers
Reviewed By: #libc, Mordante Spies: Mordante, libcxx-commits Differential Revision: https://reviews.llvm.org/D155261
1 parent 1e7c79d commit f3589d2

19 files changed

+116
-152
lines changed

libcxx/include/__math/abs.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fabs(long double
3434
return __builtin_fabsl(__x);
3535
}
3636

37-
template <class _A1>
38-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type
39-
fabs(_A1 __x) _NOEXCEPT {
37+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
38+
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI double fabs(_A1 __x) _NOEXCEPT {
4039
return __builtin_fabs((double)__x);
4140
}
4241

libcxx/include/__math/copysign.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double copysign(long dou
3333
return ::__builtin_copysignl(__x, __y);
3434
}
3535

36-
template <class _A1, class _A2>
37-
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
38-
typename __enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, __promote<_A1, _A2> >::type
39-
copysign(_A1 __x, _A2 __y) _NOEXCEPT {
36+
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
37+
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type
38+
copysign(_A1 __x, _A2 __y) _NOEXCEPT {
4039
return ::__builtin_copysign(__x, __y);
4140
}
4241

libcxx/include/__math/error_functions.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ _LIBCPP_HIDE_FROM_ABI double erf(double __x) _NOEXCEPT {
3232

3333
inline _LIBCPP_HIDE_FROM_ABI long double erf(long double __x) _NOEXCEPT { return __builtin_erfl(__x); }
3434

35-
template <class _A1>
36-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type erf(_A1 __x) _NOEXCEPT {
35+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
36+
inline _LIBCPP_HIDE_FROM_ABI double erf(_A1 __x) _NOEXCEPT {
3737
return __builtin_erf((double)__x);
3838
}
3939

@@ -48,8 +48,8 @@ _LIBCPP_HIDE_FROM_ABI double erfc(double __x) _NOEXCEPT {
4848

4949
inline _LIBCPP_HIDE_FROM_ABI long double erfc(long double __x) _NOEXCEPT { return __builtin_erfcl(__x); }
5050

51-
template <class _A1>
52-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type erfc(_A1 __x) _NOEXCEPT {
51+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
52+
inline _LIBCPP_HIDE_FROM_ABI double erfc(_A1 __x) _NOEXCEPT {
5353
return __builtin_erfc((double)__x);
5454
}
5555

libcxx/include/__math/exponential_functions.h

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ _LIBCPP_HIDE_FROM_ABI double exp(double __x) _NOEXCEPT {
3535

3636
inline _LIBCPP_HIDE_FROM_ABI long double exp(long double __x) _NOEXCEPT { return __builtin_expl(__x); }
3737

38-
template <class _A1>
39-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type exp(_A1 __x) _NOEXCEPT {
38+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
39+
inline _LIBCPP_HIDE_FROM_ABI double exp(_A1 __x) _NOEXCEPT {
4040
return __builtin_exp((double)__x);
4141
}
4242

@@ -53,9 +53,8 @@ inline _LIBCPP_HIDE_FROM_ABI long double frexp(long double __x, int* __e) _NOEXC
5353
return __builtin_frexpl(__x, __e);
5454
}
5555

56-
template <class _A1>
57-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type
58-
frexp(_A1 __x, int* __e) _NOEXCEPT {
56+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
57+
inline _LIBCPP_HIDE_FROM_ABI double frexp(_A1 __x, int* __e) _NOEXCEPT {
5958
return __builtin_frexp((double)__x, __e);
6059
}
6160

@@ -72,9 +71,8 @@ inline _LIBCPP_HIDE_FROM_ABI long double ldexp(long double __x, int __e) _NOEXCE
7271
return __builtin_ldexpl(__x, __e);
7372
}
7473

75-
template <class _A1>
76-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type
77-
ldexp(_A1 __x, int __e) _NOEXCEPT {
74+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
75+
inline _LIBCPP_HIDE_FROM_ABI double ldexp(_A1 __x, int __e) _NOEXCEPT {
7876
return __builtin_ldexp((double)__x, __e);
7977
}
8078

@@ -89,8 +87,8 @@ _LIBCPP_HIDE_FROM_ABI double exp2(double __x) _NOEXCEPT {
8987

9088
inline _LIBCPP_HIDE_FROM_ABI long double exp2(long double __x) _NOEXCEPT { return __builtin_exp2l(__x); }
9189

92-
template <class _A1>
93-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type exp2(_A1 __x) _NOEXCEPT {
90+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
91+
inline _LIBCPP_HIDE_FROM_ABI double exp2(_A1 __x) _NOEXCEPT {
9492
return __builtin_exp2((double)__x);
9593
}
9694

@@ -105,8 +103,8 @@ _LIBCPP_HIDE_FROM_ABI double expm1(double __x) _NOEXCEPT {
105103

106104
inline _LIBCPP_HIDE_FROM_ABI long double expm1(long double __x) _NOEXCEPT { return __builtin_expm1l(__x); }
107105

108-
template <class _A1>
109-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type expm1(_A1 __x) _NOEXCEPT {
106+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
107+
inline _LIBCPP_HIDE_FROM_ABI double expm1(_A1 __x) _NOEXCEPT {
110108
return __builtin_expm1((double)__x);
111109
}
112110

@@ -123,9 +121,8 @@ inline _LIBCPP_HIDE_FROM_ABI long double scalbln(long double __x, long __y) _NOE
123121
return __builtin_scalblnl(__x, __y);
124122
}
125123

126-
template <class _A1>
127-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type
128-
scalbln(_A1 __x, long __y) _NOEXCEPT {
124+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
125+
inline _LIBCPP_HIDE_FROM_ABI double scalbln(_A1 __x, long __y) _NOEXCEPT {
129126
return __builtin_scalbln((double)__x, __y);
130127
}
131128

@@ -142,9 +139,8 @@ inline _LIBCPP_HIDE_FROM_ABI long double scalbn(long double __x, int __y) _NOEXC
142139
return __builtin_scalbnl(__x, __y);
143140
}
144141

145-
template <class _A1>
146-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type
147-
scalbn(_A1 __x, int __y) _NOEXCEPT {
142+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
143+
inline _LIBCPP_HIDE_FROM_ABI double scalbn(_A1 __x, int __y) _NOEXCEPT {
148144
return __builtin_scalbn((double)__x, __y);
149145
}
150146

@@ -161,10 +157,8 @@ inline _LIBCPP_HIDE_FROM_ABI long double pow(long double __x, long double __y) _
161157
return __builtin_powl(__x, __y);
162158
}
163159

164-
template <class _A1, class _A2>
165-
inline _LIBCPP_HIDE_FROM_ABI
166-
typename __enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, __promote<_A1, _A2> >::type
167-
pow(_A1 __x, _A2 __y) _NOEXCEPT {
160+
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
161+
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type pow(_A1 __x, _A2 __y) _NOEXCEPT {
168162
typedef typename __promote<_A1, _A2>::type __result_type;
169163
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
170164
return __math::pow((__result_type)__x, (__result_type)__y);

libcxx/include/__math/fdim.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ inline _LIBCPP_HIDE_FROM_ABI long double fdim(long double __x, long double __y)
3434
return __builtin_fdiml(__x, __y);
3535
}
3636

37-
template <class _A1, class _A2>
38-
inline _LIBCPP_HIDE_FROM_ABI
39-
typename __enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, __promote<_A1, _A2> >::type
40-
fdim(_A1 __x, _A2 __y) _NOEXCEPT {
37+
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
38+
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fdim(_A1 __x, _A2 __y) _NOEXCEPT {
4139
typedef typename __promote<_A1, _A2>::type __result_type;
4240
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
4341
return __math::fdim((__result_type)__x, (__result_type)__y);

libcxx/include/__math/fma.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ inline _LIBCPP_HIDE_FROM_ABI long double fma(long double __x, long double __y, l
3636
return __builtin_fmal(__x, __y, __z);
3737
}
3838

39-
template <class _A1, class _A2, class _A3>
40-
inline _LIBCPP_HIDE_FROM_ABI
41-
typename __enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value,
42-
__promote<_A1, _A2, _A3> >::type
43-
fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT {
39+
template <class _A1,
40+
class _A2,
41+
class _A3,
42+
__enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value, int> = 0>
43+
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2, _A3>::type fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT {
4444
typedef typename __promote<_A1, _A2, _A3>::type __result_type;
4545
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value &&
4646
_IsSame<_A3, __result_type>::value)),

libcxx/include/__math/gamma.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ _LIBCPP_HIDE_FROM_ABI double lgamma(double __x) _NOEXCEPT {
3232

3333
inline _LIBCPP_HIDE_FROM_ABI long double lgamma(long double __x) _NOEXCEPT { return __builtin_lgammal(__x); }
3434

35-
template <class _A1>
36-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type lgamma(_A1 __x) _NOEXCEPT {
35+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
36+
inline _LIBCPP_HIDE_FROM_ABI double lgamma(_A1 __x) _NOEXCEPT {
3737
return __builtin_lgamma((double)__x);
3838
}
3939

@@ -50,8 +50,8 @@ _LIBCPP_HIDE_FROM_ABI double tgamma(double __x) _NOEXCEPT {
5050

5151
inline _LIBCPP_HIDE_FROM_ABI long double tgamma(long double __x) _NOEXCEPT { return __builtin_tgammal(__x); }
5252

53-
template <class _A1>
54-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type tgamma(_A1 __x) _NOEXCEPT {
53+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
54+
inline _LIBCPP_HIDE_FROM_ABI double tgamma(_A1 __x) _NOEXCEPT {
5555
return __builtin_tgamma((double)__x);
5656
}
5757

libcxx/include/__math/hyperbolic_functions.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ _LIBCPP_HIDE_FROM_ABI double cosh(double __x) _NOEXCEPT {
3232

3333
inline _LIBCPP_HIDE_FROM_ABI long double cosh(long double __x) _NOEXCEPT { return __builtin_coshl(__x); }
3434

35-
template <class _A1>
36-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type cosh(_A1 __x) _NOEXCEPT {
35+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
36+
inline _LIBCPP_HIDE_FROM_ABI double cosh(_A1 __x) _NOEXCEPT {
3737
return __builtin_cosh((double)__x);
3838
}
3939

@@ -48,8 +48,8 @@ _LIBCPP_HIDE_FROM_ABI double sinh(double __x) _NOEXCEPT {
4848

4949
inline _LIBCPP_HIDE_FROM_ABI long double sinh(long double __x) _NOEXCEPT { return __builtin_sinhl(__x); }
5050

51-
template <class _A1>
52-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type sinh(_A1 __x) _NOEXCEPT {
51+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
52+
inline _LIBCPP_HIDE_FROM_ABI double sinh(_A1 __x) _NOEXCEPT {
5353
return __builtin_sinh((double)__x);
5454
}
5555

@@ -64,8 +64,8 @@ _LIBCPP_HIDE_FROM_ABI double tanh(double __x) _NOEXCEPT {
6464

6565
inline _LIBCPP_HIDE_FROM_ABI long double tanh(long double __x) _NOEXCEPT { return __builtin_tanhl(__x); }
6666

67-
template <class _A1>
68-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type tanh(_A1 __x) _NOEXCEPT {
67+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
68+
inline _LIBCPP_HIDE_FROM_ABI double tanh(_A1 __x) _NOEXCEPT {
6969
return __builtin_tanh((double)__x);
7070
}
7171

libcxx/include/__math/hypot.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y)
3434
return __builtin_hypotl(__x, __y);
3535
}
3636

37-
template <class _A1, class _A2>
38-
inline _LIBCPP_HIDE_FROM_ABI
39-
typename __enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, __promote<_A1, _A2> >::type
40-
hypot(_A1 __x, _A2 __y) _NOEXCEPT {
37+
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
38+
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type hypot(_A1 __x, _A2 __y) _NOEXCEPT {
4139
typedef typename __promote<_A1, _A2>::type __result_type;
4240
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
4341
return __math::hypot((__result_type)__x, (__result_type)__y);

libcxx/include/__math/inverse_hyperbolic_functions.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ _LIBCPP_HIDE_FROM_ABI double acosh(double __x) _NOEXCEPT {
3232

3333
inline _LIBCPP_HIDE_FROM_ABI long double acosh(long double __x) _NOEXCEPT { return __builtin_acoshl(__x); }
3434

35-
template <class _A1>
36-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type acosh(_A1 __x) _NOEXCEPT {
35+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
36+
inline _LIBCPP_HIDE_FROM_ABI double acosh(_A1 __x) _NOEXCEPT {
3737
return __builtin_acosh((double)__x);
3838
}
3939

@@ -48,8 +48,8 @@ _LIBCPP_HIDE_FROM_ABI double asinh(double __x) _NOEXCEPT {
4848

4949
inline _LIBCPP_HIDE_FROM_ABI long double asinh(long double __x) _NOEXCEPT { return __builtin_asinhl(__x); }
5050

51-
template <class _A1>
52-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type asinh(_A1 __x) _NOEXCEPT {
51+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
52+
inline _LIBCPP_HIDE_FROM_ABI double asinh(_A1 __x) _NOEXCEPT {
5353
return __builtin_asinh((double)__x);
5454
}
5555

@@ -64,8 +64,8 @@ _LIBCPP_HIDE_FROM_ABI double atanh(double __x) _NOEXCEPT {
6464

6565
inline _LIBCPP_HIDE_FROM_ABI long double atanh(long double __x) _NOEXCEPT { return __builtin_atanhl(__x); }
6666

67-
template <class _A1>
68-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type atanh(_A1 __x) _NOEXCEPT {
67+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
68+
inline _LIBCPP_HIDE_FROM_ABI double atanh(_A1 __x) _NOEXCEPT {
6969
return __builtin_atanh((double)__x);
7070
}
7171

libcxx/include/__math/inverse_trigonometric_functions.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ _LIBCPP_HIDE_FROM_ABI double acos(double __x) _NOEXCEPT {
3535

3636
inline _LIBCPP_HIDE_FROM_ABI long double acos(long double __x) _NOEXCEPT { return __builtin_acosl(__x); }
3737

38-
template <class _A1>
39-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type acos(_A1 __x) _NOEXCEPT {
38+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
39+
inline _LIBCPP_HIDE_FROM_ABI double acos(_A1 __x) _NOEXCEPT {
4040
return __builtin_acos((double)__x);
4141
}
4242

@@ -51,8 +51,8 @@ _LIBCPP_HIDE_FROM_ABI double asin(double __x) _NOEXCEPT {
5151

5252
inline _LIBCPP_HIDE_FROM_ABI long double asin(long double __x) _NOEXCEPT { return __builtin_asinl(__x); }
5353

54-
template <class _A1>
55-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type asin(_A1 __x) _NOEXCEPT {
54+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
55+
inline _LIBCPP_HIDE_FROM_ABI double asin(_A1 __x) _NOEXCEPT {
5656
return __builtin_asin((double)__x);
5757
}
5858

@@ -67,8 +67,8 @@ _LIBCPP_HIDE_FROM_ABI double atan(double __x) _NOEXCEPT {
6767

6868
inline _LIBCPP_HIDE_FROM_ABI long double atan(long double __x) _NOEXCEPT { return __builtin_atanl(__x); }
6969

70-
template <class _A1>
71-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type atan(_A1 __x) _NOEXCEPT {
70+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
71+
inline _LIBCPP_HIDE_FROM_ABI double atan(_A1 __x) _NOEXCEPT {
7272
return __builtin_atan((double)__x);
7373
}
7474

@@ -85,10 +85,8 @@ inline _LIBCPP_HIDE_FROM_ABI long double atan2(long double __y, long double __x)
8585
return __builtin_atan2l(__y, __x);
8686
}
8787

88-
template <class _A1, class _A2>
89-
inline _LIBCPP_HIDE_FROM_ABI
90-
typename __enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, __promote<_A1, _A2> >::type
91-
atan2(_A1 __y, _A2 __x) _NOEXCEPT {
88+
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
89+
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type atan2(_A1 __y, _A2 __x) _NOEXCEPT {
9290
typedef typename __promote<_A1, _A2>::type __result_type;
9391
static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
9492
return __math::atan2((__result_type)__y, (__result_type)__x);

libcxx/include/__math/logarithms.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ _LIBCPP_HIDE_FROM_ABI double log(double __x) _NOEXCEPT {
3232

3333
inline _LIBCPP_HIDE_FROM_ABI long double log(long double __x) _NOEXCEPT { return __builtin_logl(__x); }
3434

35-
template <class _A1>
36-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type log(_A1 __x) _NOEXCEPT {
35+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
36+
inline _LIBCPP_HIDE_FROM_ABI double log(_A1 __x) _NOEXCEPT {
3737
return __builtin_log((double)__x);
3838
}
3939

@@ -48,8 +48,8 @@ _LIBCPP_HIDE_FROM_ABI double log10(double __x) _NOEXCEPT {
4848

4949
inline _LIBCPP_HIDE_FROM_ABI long double log10(long double __x) _NOEXCEPT { return __builtin_log10l(__x); }
5050

51-
template <class _A1>
52-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type log10(_A1 __x) _NOEXCEPT {
51+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
52+
inline _LIBCPP_HIDE_FROM_ABI double log10(_A1 __x) _NOEXCEPT {
5353
return __builtin_log10((double)__x);
5454
}
5555

@@ -64,8 +64,8 @@ _LIBCPP_HIDE_FROM_ABI double ilogb(double __x) _NOEXCEPT {
6464

6565
inline _LIBCPP_HIDE_FROM_ABI int ilogb(long double __x) _NOEXCEPT { return __builtin_ilogbl(__x); }
6666

67-
template <class _A1>
68-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, int>::type ilogb(_A1 __x) _NOEXCEPT {
67+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
68+
inline _LIBCPP_HIDE_FROM_ABI int ilogb(_A1 __x) _NOEXCEPT {
6969
return __builtin_ilogb((double)__x);
7070
}
7171

@@ -80,8 +80,8 @@ _LIBCPP_HIDE_FROM_ABI double log1p(double __x) _NOEXCEPT {
8080

8181
inline _LIBCPP_HIDE_FROM_ABI long double log1p(long double __x) _NOEXCEPT { return __builtin_log1pl(__x); }
8282

83-
template <class _A1>
84-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type log1p(_A1 __x) _NOEXCEPT {
83+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
84+
inline _LIBCPP_HIDE_FROM_ABI double log1p(_A1 __x) _NOEXCEPT {
8585
return __builtin_log1p((double)__x);
8686
}
8787

@@ -96,8 +96,8 @@ _LIBCPP_HIDE_FROM_ABI double log2(double __x) _NOEXCEPT {
9696

9797
inline _LIBCPP_HIDE_FROM_ABI long double log2(long double __x) _NOEXCEPT { return __builtin_log2l(__x); }
9898

99-
template <class _A1>
100-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type log2(_A1 __x) _NOEXCEPT {
99+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
100+
inline _LIBCPP_HIDE_FROM_ABI double log2(_A1 __x) _NOEXCEPT {
101101
return __builtin_log2((double)__x);
102102
}
103103

@@ -112,8 +112,8 @@ _LIBCPP_HIDE_FROM_ABI double logb(double __x) _NOEXCEPT {
112112

113113
inline _LIBCPP_HIDE_FROM_ABI long double logb(long double __x) _NOEXCEPT { return __builtin_logbl(__x); }
114114

115-
template <class _A1>
116-
inline _LIBCPP_HIDE_FROM_ABI typename enable_if<is_integral<_A1>::value, double>::type logb(_A1 __x) _NOEXCEPT {
115+
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
116+
inline _LIBCPP_HIDE_FROM_ABI double logb(_A1 __x) _NOEXCEPT {
117117
return __builtin_logb((double)__x);
118118
}
119119

0 commit comments

Comments
 (0)