Commit f3c681f0 authored by Jiapeng Chong's avatar Jiapeng Chong Committed by Alex Deucher

drm/amd/display: use swap() in sort()

Use existing swap() function rather than duplicating its implementation.

./drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn3.c:17:29-30: WARNING opportunity for swap().
Reported-by: default avatarAbaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9573Signed-off-by: default avatarJiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent fdedd77b
...@@ -7,16 +7,12 @@ ...@@ -7,16 +7,12 @@
static void sort(double *list_a, int list_a_size) static void sort(double *list_a, int list_a_size)
{ {
double temp;
// For all elements b[i] in list_b[] // For all elements b[i] in list_b[]
for (int i = 0; i < list_a_size - 1; i++) { for (int i = 0; i < list_a_size - 1; i++) {
// Find the first element of list_a that's larger than b[i] // Find the first element of list_a that's larger than b[i]
for (int j = i; j < list_a_size - 1; j++) { for (int j = i; j < list_a_size - 1; j++) {
if (list_a[j] > list_a[j + 1]) { if (list_a[j] > list_a[j + 1])
temp = list_a[j]; swap(list_a[j], list_a[j + 1]);
list_a[j] = list_a[j + 1];
list_a[j + 1] = temp;
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment