mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-08 05:27:14 +09:00
AK: Remove redundant condition from Quick Sort
if (size <= 1) return; This means that size is at the very minimum 2, and pivot_point at the very minimum equals 1 as size / 2; The condition if (pivot_point) can never be false.
This commit is contained in:
parent
349caecc18
commit
2be45c1ccf
Notes:
github-actions[bot]
2024-12-22 11:35:14 +00:00
Author: https://github.com/shlyakpavel
Commit: 2be45c1ccf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2984
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/gmta
1 changed files with 1 additions and 2 deletions
|
@ -113,8 +113,7 @@ void single_pivot_quick_sort(Iterator start, Iterator end, LessThan less_than)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int pivot_point = size / 2;
|
int pivot_point = size / 2;
|
||||||
if (pivot_point)
|
swap(*(start + pivot_point), *start);
|
||||||
swap(*(start + pivot_point), *start);
|
|
||||||
|
|
||||||
auto&& pivot = *start;
|
auto&& pivot = *start;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue