stdlib: Optimization qsort{_r} swap implementation
commit21d30c774c7f9f5878f0bf9438736c702b0a58a3
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 3 Oct 2023 12:22:46 +0000 (3 09:22 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 31 Oct 2023 17:17:42 +0000 (31 14:17 -0300)
tree31583a8d78ebccd92955d1e8341c16884af99417
parentfccf38c51746e0817c2409bb361398f9465e0760
stdlib: Optimization qsort{_r} swap implementation

The optimization takes in consideration both the most common elements
are either 32 or 64 bit in size and inputs are aligned to the word
boundary.  This is similar to what msort does.

For large buffer the swap operation uses memcpy/mempcpy with a
small fixed size buffer (so compiler might inline the operations).

Checked on x86_64-linux-gnu.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
stdlib/qsort.c