diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-10-15 00:24:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-15 00:24:35 +0200 |
| commit | 27a396db4fd2e9734dab63d203fb354084e2c237 (patch) | |
| tree | 998fe71c701da161fc7726694644532fa4d577dc /lib/libcxx/include/__algorithm/sort.h | |
| parent | 4edebf40d53c7e69afd088c9967f13ab8aafe1fd (diff) | |
| parent | bc58b5dc53cce066d224925ce8fb4bb79665a1d1 (diff) | |
| download | zig-27a396db4fd2e9734dab63d203fb354084e2c237.tar.gz zig-27a396db4fd2e9734dab63d203fb354084e2c237.zip | |
Merge pull request #25572 from alexrp/libcxx-backports
`libcxx`: backport llvm/llvm-project#155476, llvm/llvm-project#147389, llvm/llvm-project#155786
Diffstat (limited to 'lib/libcxx/include/__algorithm/sort.h')
| -rw-r--r-- | lib/libcxx/include/__algorithm/sort.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libcxx/include/__algorithm/sort.h b/lib/libcxx/include/__algorithm/sort.h index 06cb5b8ce7..8aa894e922 100644 --- a/lib/libcxx/include/__algorithm/sort.h +++ b/lib/libcxx/include/__algorithm/sort.h @@ -860,6 +860,9 @@ __sort<__less<long double>&, long double*>(long double*, long double*, __less<lo template <class _AlgPolicy, class _RandomAccessIterator, class _Comp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __sort_dispatch(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) { + if (__first == __last) // log(0) is undefined, so don't try computing the depth + return; + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; difference_type __depth_limit = 2 * std::__bit_log2(std::__to_unsigned_like(__last - __first)); |
