File tree Expand file tree Collapse file tree 3 files changed +9
-37
lines changed Expand file tree Collapse file tree 3 files changed +9
-37
lines changed Original file line number Diff line number Diff line change @@ -59,25 +59,15 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x)
59
59
}
60
60
#endif // _LIBCPP_HAS_NO_INT128
61
61
62
- #if __has_builtin(__builtin_clzg)
63
-
64
62
template <class _Tp >
65
63
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero (_Tp __t ) _NOEXCEPT {
66
64
static_assert (__libcpp_is_unsigned_integer<_Tp>::value, " __countl_zero requires an unsigned integer type" );
67
65
if (__t == 0 )
68
66
return numeric_limits<_Tp>::digits;
69
67
68
+ #if __has_builtin(__builtin_clzg)
70
69
return __builtin_clzg (__t );
71
- }
72
-
73
- #else // __has_builtin(__builtin_clzg)
74
-
75
- template <class _Tp >
76
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero (_Tp __t ) _NOEXCEPT {
77
- static_assert (__libcpp_is_unsigned_integer<_Tp>::value, " __countl_zero requires an unsigned integer type" );
78
- if (__t == 0 )
79
- return numeric_limits<_Tp>::digits;
80
-
70
+ #else // __has_builtin(__builtin_clzg)
81
71
if (sizeof (_Tp) <= sizeof (unsigned int ))
82
72
return std::__libcpp_clz (static_cast <unsigned int >(__t )) -
83
73
(numeric_limits<unsigned int >::digits - numeric_limits<_Tp>::digits);
@@ -99,9 +89,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero(_Tp __t) _
99
89
}
100
90
return __ret + __iter;
101
91
}
102
- }
103
-
104
92
#endif // __has_builtin(__builtin_clzg)
93
+ }
105
94
106
95
#if _LIBCPP_STD_VER >= 20
107
96
Original file line number Diff line number Diff line change @@ -38,23 +38,14 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ct
38
38
return __builtin_ctzll (__x);
39
39
}
40
40
41
- #if __has_builtin(__builtin_ctzg)
42
-
43
41
template <class _Tp >
44
42
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countr_zero (_Tp __t ) _NOEXCEPT {
45
43
if (__t == 0 )
46
44
return numeric_limits<_Tp>::digits;
47
45
46
+ #if __has_builtin(__builtin_ctzg)
48
47
return __builtin_ctzg (__t );
49
- }
50
-
51
- #else // __has_builtin(__builtin_ctzg)
52
-
53
- template <class _Tp >
54
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countr_zero (_Tp __t ) _NOEXCEPT {
55
- if (__t == 0 )
56
- return numeric_limits<_Tp>::digits;
57
-
48
+ #else // __has_builtin(__builtin_ctzg)
58
49
if (sizeof (_Tp) <= sizeof (unsigned int ))
59
50
return std::__libcpp_ctz (static_cast <unsigned int >(__t ));
60
51
else if (sizeof (_Tp) <= sizeof (unsigned long ))
@@ -70,9 +61,8 @@ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __coun
70
61
}
71
62
return __ret + std::__libcpp_ctz (static_cast <unsigned long long >(__t ));
72
63
}
73
- }
74
-
75
64
#endif // __has_builtin(__builtin_ctzg)
65
+ }
76
66
77
67
#if _LIBCPP_STD_VER >= 20
78
68
Original file line number Diff line number Diff line change @@ -40,17 +40,11 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_popcount(unsigned lo
40
40
41
41
#if _LIBCPP_STD_VER >= 20
42
42
43
- # if __has_builtin(__builtin_popcountg)
44
-
45
43
template <__libcpp_unsigned_integer _Tp>
46
44
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr int popcount (_Tp __t ) noexcept {
45
+ # if __has_builtin(__builtin_popcountg)
47
46
return __builtin_popcountg (__t );
48
- }
49
-
50
- # else // __has_builtin(__builtin_popcountg)
51
-
52
- template <__libcpp_unsigned_integer _Tp>
53
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr int popcount (_Tp __t ) noexcept {
47
+ # else // __has_builtin(__builtin_popcountg)
54
48
if (sizeof (_Tp) <= sizeof (unsigned int ))
55
49
return std::__libcpp_popcount (static_cast <unsigned int >(__t ));
56
50
else if (sizeof (_Tp) <= sizeof (unsigned long ))
@@ -65,9 +59,8 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr int popcount(_Tp __t) noex
65
59
}
66
60
return __ret;
67
61
}
68
- }
69
-
70
62
# endif // __has_builtin(__builtin_popcountg)
63
+ }
71
64
72
65
#endif // _LIBCPP_STD_VER >= 20
73
66
You can’t perform that action at this time.
0 commit comments