Don't return the number of swaps; it's not used anywhere.
Details
Details
- Reviewers
ldionne Mordante var-const avogelsgesang - Group Reviewers
Restricted Project - Commits
- rG811b5f52adcb: [libc++][NFC] Simplify __sort{4,5}
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
__sort3 is used in nth_element, where the swap count is actually used, so that can't be simplified
Comment Actions
Nice catch! LGTM!
Did you happen to benchmark the performance difference?
libcxx/include/__algorithm/sort.h | ||
---|---|---|
49 | I would be tempted to return a bool instead, it seems __nth_element only cares about whether or not a swap is done. (Obviously something for a separate patch.) |
I would be tempted to return a bool instead, it seems __nth_element only cares about whether or not a swap is done. (Obviously something for a separate patch.)