mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-05 01:10:24 +00: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:
committed by
Andreas Kling
parent
349caecc18
commit
2be45c1ccf
Notes:
github-actions[bot]
2024-12-22 11:35:14 +00:00
Author: https://github.com/shlyakpavel Commit: https://github.com/LadybirdBrowser/ladybird/commit/2be45c1ccf0 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2984 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/gmta
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user