MCPcopy Create free account
hub / github.com/FastLED/FastLED / mergesort_impl

Function mergesort_impl

src/fl/stl/algorithm.h:534–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532// Merge sort implementation (stable, in-place)
533template <typename Iterator, typename Compare>
534void mergesort_impl(Iterator first, Iterator last, Compare comp) FL_NOEXCEPT {
535 auto size = last - first;
536 if (size <= 16) { // Use insertion sort for small arrays (it's stable)
537 insertion_sort(first, last, comp);
538 return;
539 }
540
541 Iterator middle = first + size / 2;
542 mergesort_impl(first, middle, comp);
543 mergesort_impl(middle, last, comp);
544 merge_inplace(first, middle, last, comp);
545}
546
547} // namespace detail
548

Callers 1

stable_sortFunction · 0.85

Calls 2

insertion_sortFunction · 0.85
merge_inplaceFunction · 0.85

Tested by

no test coverage detected