[libcxx-commits] [libcxx] [libcxx][algorithm] Optimize std::stable_sort via radix sort algorithm (PR #104683)
Дмитрий Изволов via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 28 12:39:21 PST 2024
================
@@ -190,6 +196,28 @@ struct __stable_sort_switch {
static const unsigned value = 128 * is_trivially_copy_assignable<_Tp>::value;
};
+#if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+constexpr unsigned __radix_sort_min_bound() {
+ static_assert(is_integral<_Tp>::value);
+ if constexpr (sizeof(_Tp) == 1) {
+ return 1 << 8;
+ }
+
+ return 1 << 10;
+}
+
+template <class _Tp>
+constexpr unsigned __radix_sort_max_bound() {
+ static_assert(is_integral<_Tp>::value);
+ if constexpr (sizeof(_Tp) == 8) {
----------------
izvolov wrote:
Yes, thank you.
Done.
https://github.com/llvm/llvm-project/pull/104683
More information about the libcxx-commits
mailing list