From 2be45c1ccf0de5491d32b2f40a85923f96ea1c9a Mon Sep 17 00:00:00 2001 From: Pavel Shliak Date: Fri, 20 Dec 2024 01:47:29 +0400 Subject: [PATCH] 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. --- AK/QuickSort.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/AK/QuickSort.h b/AK/QuickSort.h index a9ae1679162..bd9c15dba89 100644 --- a/AK/QuickSort.h +++ b/AK/QuickSort.h @@ -113,8 +113,7 @@ void single_pivot_quick_sort(Iterator start, Iterator end, LessThan less_than) return; int pivot_point = size / 2; - if (pivot_point) - swap(*(start + pivot_point), *start); + swap(*(start + pivot_point), *start); auto&& pivot = *start;