2929
3030#include < __algorithm/for_each.h>
3131#include < __algorithm/move.h>
32+ #include < __bit/bit_log2.h>
3233#include < __bit/countl.h>
3334#include < __config>
3435#include < __functional/identity.h>
@@ -65,13 +66,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
6566
6667#if _LIBCPP_STD_VER >= 14
6768
68- template <class _UnsignedInteger >
69- _LIBCPP_HIDE_FROM_ABI constexpr _UnsignedInteger __intlog2 (_UnsignedInteger __n) {
70- static_assert (is_unsigned<_UnsignedInteger>::value, " Must be unsigned integral" );
71-
72- return numeric_limits<_UnsignedInteger>::digits - 1 - std::__countl_zero (__n);
73- }
74-
7569template <class _InputIterator , class _OutputIterator >
7670_LIBCPP_HIDE_FROM_ABI pair<_OutputIterator, __iter_value_type<_InputIterator>>
7771__partial_sum_max (_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
@@ -101,7 +95,7 @@ struct __radix_sort_traits {
10195 static_assert (is_integral<__radix_type>::value, " " );
10296
10397 constexpr static auto __radix_value_range = numeric_limits<__radix_type>::max() + 1 ;
104- constexpr static auto __radix_size = std::__intlog2 <uint64_t >(__radix_value_range);
98+ constexpr static auto __radix_size = std::__bit_log2 <uint64_t >(__radix_value_range);
10599 constexpr static auto __radix_count = sizeof (__image_type) * CHAR_BIT / __radix_size;
106100};
107101
@@ -111,7 +105,7 @@ struct __counting_sort_traits {
111105 static_assert (is_unsigned<__image_type>::value, " " );
112106
113107 constexpr static const auto __value_range = numeric_limits<__image_type>::max() + 1 ;
114- constexpr static auto __radix_size = std::__intlog2 <uint64_t >(__value_range);
108+ constexpr static auto __radix_size = std::__bit_log2 <uint64_t >(__value_range);
115109};
116110
117111template <class _Radix , class _Integer >
0 commit comments