Skip to content

Commit 16a8c1d

Browse files
committed
Avoid duplicate signatures
1 parent a529487 commit 16a8c1d

File tree

3 files changed

+9
-37
lines changed

3 files changed

+9
-37
lines changed

libcxx/include/__bit/countl.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,15 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x)
5959
}
6060
#endif // _LIBCPP_HAS_NO_INT128
6161

62-
#if __has_builtin(__builtin_clzg)
63-
6462
template <class _Tp>
6563
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero(_Tp __t) _NOEXCEPT {
6664
static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires an unsigned integer type");
6765
if (__t == 0)
6866
return numeric_limits<_Tp>::digits;
6967

68+
#if __has_builtin(__builtin_clzg)
7069
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)
8171
if (sizeof(_Tp) <= sizeof(unsigned int))
8272
return std::__libcpp_clz(static_cast<unsigned int>(__t)) -
8373
(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) _
9989
}
10090
return __ret + __iter;
10191
}
102-
}
103-
10492
#endif // __has_builtin(__builtin_clzg)
93+
}
10594

10695
#if _LIBCPP_STD_VER >= 20
10796

libcxx/include/__bit/countr.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,14 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ct
3838
return __builtin_ctzll(__x);
3939
}
4040

41-
#if __has_builtin(__builtin_ctzg)
42-
4341
template <class _Tp>
4442
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countr_zero(_Tp __t) _NOEXCEPT {
4543
if (__t == 0)
4644
return numeric_limits<_Tp>::digits;
4745

46+
#if __has_builtin(__builtin_ctzg)
4847
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)
5849
if (sizeof(_Tp) <= sizeof(unsigned int))
5950
return std::__libcpp_ctz(static_cast<unsigned int>(__t));
6051
else if (sizeof(_Tp) <= sizeof(unsigned long))
@@ -70,9 +61,8 @@ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __coun
7061
}
7162
return __ret + std::__libcpp_ctz(static_cast<unsigned long long>(__t));
7263
}
73-
}
74-
7564
#endif // __has_builtin(__builtin_ctzg)
65+
}
7666

7767
#if _LIBCPP_STD_VER >= 20
7868

libcxx/include/__bit/popcount.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,11 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_popcount(unsigned lo
4040

4141
#if _LIBCPP_STD_VER >= 20
4242

43-
# if __has_builtin(__builtin_popcountg)
44-
4543
template <__libcpp_unsigned_integer _Tp>
4644
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr int popcount(_Tp __t) noexcept {
45+
# if __has_builtin(__builtin_popcountg)
4746
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)
5448
if (sizeof(_Tp) <= sizeof(unsigned int))
5549
return std::__libcpp_popcount(static_cast<unsigned int>(__t));
5650
else if (sizeof(_Tp) <= sizeof(unsigned long))
@@ -65,9 +59,8 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr int popcount(_Tp __t) noex
6559
}
6660
return __ret;
6761
}
68-
}
69-
7062
# endif // __has_builtin(__builtin_popcountg)
63+
}
7164

7265
#endif // _LIBCPP_STD_VER >= 20
7366

0 commit comments

Comments
 (0)