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

Method sort

src/fl/stl/list.h:499–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

497 }
498
499 void sort() {
500 // Insertion sort for simplicity (appropriate for embedded systems)
501 if (mSize <= 1) {
502 return;
503 }
504
505 Node* sorted_end = mHead->next;
506
507 while (sorted_end->next != mHead) {
508 Node* current = sorted_end->next;
509
510 // Find insertion point in sorted portion
511 Node* insert_pos = mHead->next;
512 while (insert_pos != sorted_end->next && insert_pos->data < current->data) {
513 insert_pos = insert_pos->next;
514 }
515
516 // If current is already in correct position
517 if (insert_pos == current) {
518 sorted_end = current;
519 } else {
520 // Remove current from its position
521 unlink(current);
522 // Insert before insert_pos
523 link_before(insert_pos, current);
524 }
525 }
526 }
527
528 template<typename Compare>
529 void sort(Compare comp) {

Callers 14

list_examplesFunction · 0.80
display_function_sizesFunction · 0.80
print_health_reportMethod · 0.80
_collect_filesFunction · 0.80
get_all_examplesFunction · 0.80
get_top_operationsMethod · 0.80
smart_selectFunction · 0.80
dump_symbol_sizesFunction · 0.80

Calls

no outgoing calls

Tested by 1

_scandir_collect_filesFunction · 0.64