mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
libc: Sorting is not needed when there are less than two elements
If there are less than two elements avoid executing the first sorting loop. No functional change intended. Reviewed by: kib@ MFC after: 1 week Sponsored by: NVIDIA Networking Differential Revision: https://reviews.freebsd.org/D39691
This commit is contained in:
parent
409731e7d7
commit
ecb2ce3a51
1 changed files with 2 additions and 1 deletions
|
|
@ -114,7 +114,8 @@ local_qsort(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk)
|
|||
int cmp_result;
|
||||
int swap_cnt;
|
||||
|
||||
if (__predict_false(n == 0))
|
||||
/* if there are less than 2 elements, then sorting is not needed */
|
||||
if (__predict_false(n < 2))
|
||||
return;
|
||||
loop:
|
||||
swap_cnt = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue