33template <
typename T,
typename C>
39 if (j < bottom && lessThan(array[j-1], array[j])) {
42 array[
root-1] = array[j-1];
48 if (lessThan(array[j-1],
x)) {
49 array[
root-1] = array[j-1];
67template <
typename T,
typename C>
70 size_t child =
root << 1;
71 while (child <= bottom) {
72 if (child < bottom && lessThan(array[child-1], array[child])) {
75 if (lessThan(
x, array[child-1])) {
76 array[
root-1] = array[child-1];
94 for (
size_t i =
count >> 1;
i > 0; --
i) {
98 for (
size_t i =
count - 1;
i > 0; --
i) {
100 swap(array[0], array[
i]);
113template <
typename T,
typename C>
117 if (!lessThan(*
next, *(
next - 1))) {
120 T insert = std::move(*
next);
123 *hole = std::move(*(hole - 1));
125 }
while (
left < hole && lessThan(insert, *(hole - 1)));
126 *hole = std::move(insert);
132template <
typename T,
typename C>
136 T pivotValue = *pivot;
140 if (lessThan(*
left, pivotValue)) {
162template <
typename T,
typename C>
178 int pivotCount = pivot -
left;
181 left += pivotCount + 1;
182 count -= pivotCount + 1;
193template <
typename T,
typename C>
static float next(float f)
static int SkNextLog2(uint32_t value)
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
void swap(sk_sp< T > &a, sk_sp< T > &b)
void SkTIntroSort(int depth, T *left, int count, const C &lessThan)
void SkTHeapSort_SiftUp(T array[], size_t root, size_t bottom, const C &lessThan)
T * SkTQSort_Partition(T *left, int count, T *pivot, const C &lessThan)
void SkTHeapSort(T array[], size_t count, const C &lessThan)
void SkTInsertionSort(T *left, int count, const C &lessThan)
void SkTQSort(T *begin, T *end, const C &lessThan)
void SkTHeapSort_SiftDown(T array[], size_t root, size_t bottom, const C &lessThan)
constexpr int SkToInt(S x)
static const char * begin(const StringSlice &s)