mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Update pdqsort to recent version (#10171)
This commit is contained in:
parent
67235834b3
commit
19bb2976b9
@ -125,10 +125,8 @@ namespace pdqsort_detail {
|
|||||||
typedef typename std::iterator_traits<Iter>::value_type T;
|
typedef typename std::iterator_traits<Iter>::value_type T;
|
||||||
if (begin == end) return true;
|
if (begin == end) return true;
|
||||||
|
|
||||||
int limit = 0;
|
std::size_t limit = 0;
|
||||||
for (Iter cur = begin + 1; cur != end; ++cur) {
|
for (Iter cur = begin + 1; cur != end; ++cur) {
|
||||||
if (limit > partial_insertion_sort_limit) return false;
|
|
||||||
|
|
||||||
Iter sift = cur;
|
Iter sift = cur;
|
||||||
Iter sift_1 = cur - 1;
|
Iter sift_1 = cur - 1;
|
||||||
|
|
||||||
@ -142,6 +140,8 @@ namespace pdqsort_detail {
|
|||||||
*sift = PDQSORT_PREFER_MOVE(tmp);
|
*sift = PDQSORT_PREFER_MOVE(tmp);
|
||||||
limit += cur - sift;
|
limit += cur - sift;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (limit > partial_insertion_sort_limit) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -275,7 +275,7 @@ namespace pdqsort_detail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int l_size = 0, r_size = 0;
|
int l_size = 0, r_size = 0;
|
||||||
int unknown_left = (last - first) - ((num_r || num_l) ? block_size : 0);
|
int unknown_left = (int)(last - first) - ((num_r || num_l) ? block_size : 0);
|
||||||
if (num_r) {
|
if (num_r) {
|
||||||
// Handle leftover block by assigning the unknown elements to the other block.
|
// Handle leftover block by assigning the unknown elements to the other block.
|
||||||
l_size = unknown_left;
|
l_size = unknown_left;
|
||||||
|
Loading…
Reference in New Issue
Block a user