diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-10-16 02:39:56 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-10-16 02:39:56 +0800 |
| commit | 8cace3f05003c6cb4d38c36890055f03151c2ad4 (patch) | |
| tree | aa739deaac0266f17c4e91b333957501cb1ea2e9 /third_party/libcxx/include/c++/v1/__numeric | |
| parent | 3ad39e9878310e5317ee73c9b353c1e2c1c5c4ee (diff) | |
| download | lume-8cace3f05003c6cb4d38c36890055f03151c2ad4.tar.gz lume-8cace3f05003c6cb4d38c36890055f03151c2ad4.tar.xz | |
Remove old code
Signed-off-by: Richard Qin <richard.qin.x@gmail.com>
Diffstat (limited to 'third_party/libcxx/include/c++/v1/__numeric')
16 files changed, 0 insertions, 1194 deletions
diff --git a/third_party/libcxx/include/c++/v1/__numeric/accumulate.h b/third_party/libcxx/include/c++/v1/__numeric/accumulate.h deleted file mode 100644 index fedc1c4..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/accumulate.h +++ /dev/null @@ -1,53 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_ACCUMULATE_H -#define _LIBCPP___NUMERIC_ACCUMULATE_H - -#include <__config> -#include <__utility/move.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _InputIterator, class _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp -accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) { - for (; __first != __last; ++__first) -#if _LIBCPP_STD_VER >= 20 - __init = std::move(__init) + *__first; -#else - __init = __init + *__first; -#endif - return __init; -} - -template <class _InputIterator, class _Tp, class _BinaryOperation> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp -accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) { - for (; __first != __last; ++__first) -#if _LIBCPP_STD_VER >= 20 - __init = __binary_op(std::move(__init), *__first); -#else - __init = __binary_op(__init, *__first); -#endif - return __init; -} - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_ACCUMULATE_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/adjacent_difference.h b/third_party/libcxx/include/c++/v1/__numeric/adjacent_difference.h deleted file mode 100644 index 62b5334..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/adjacent_difference.h +++ /dev/null @@ -1,68 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_ADJACENT_DIFFERENCE_H -#define _LIBCPP___NUMERIC_ADJACENT_DIFFERENCE_H - -#include <__config> -#include <__iterator/iterator_traits.h> -#include <__utility/move.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _InputIterator, class _OutputIterator> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator -adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { - if (__first != __last) { - typename iterator_traits<_InputIterator>::value_type __acc(*__first); - *__result = __acc; - for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) { - typename iterator_traits<_InputIterator>::value_type __val(*__first); -#if _LIBCPP_STD_VER >= 20 - *__result = __val - std::move(__acc); -#else - *__result = __val - __acc; -#endif - __acc = std::move(__val); - } - } - return __result; -} - -template <class _InputIterator, class _OutputIterator, class _BinaryOperation> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator adjacent_difference( - _InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) { - if (__first != __last) { - typename iterator_traits<_InputIterator>::value_type __acc(*__first); - *__result = __acc; - for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) { - typename iterator_traits<_InputIterator>::value_type __val(*__first); -#if _LIBCPP_STD_VER >= 20 - *__result = __binary_op(__val, std::move(__acc)); -#else - *__result = __binary_op(__val, __acc); -#endif - __acc = std::move(__val); - } - } - return __result; -} - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_ADJACENT_DIFFERENCE_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/exclusive_scan.h b/third_party/libcxx/include/c++/v1/__numeric/exclusive_scan.h deleted file mode 100644 index af85b47..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/exclusive_scan.h +++ /dev/null @@ -1,58 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_EXCLUSIVE_SCAN_H -#define _LIBCPP___NUMERIC_EXCLUSIVE_SCAN_H - -#include <__config> -#include <__functional/operations.h> -#include <__utility/move.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator -exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init, _BinaryOp __b) { - if (__first != __last) { - _Tp __tmp(__b(__init, *__first)); - while (true) { - *__result = std::move(__init); - ++__result; - ++__first; - if (__first == __last) - break; - __init = std::move(__tmp); - __tmp = __b(__init, *__first); - } - } - return __result; -} - -template <class _InputIterator, class _OutputIterator, class _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator -exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init) { - return std::exclusive_scan(__first, __last, __result, __init, std::plus<>()); -} - -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_EXCLUSIVE_SCAN_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/gcd_lcm.h b/third_party/libcxx/include/c++/v1/__numeric/gcd_lcm.h deleted file mode 100644 index 5ab870f..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/gcd_lcm.h +++ /dev/null @@ -1,120 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_GCD_LCM_H -#define _LIBCPP___NUMERIC_GCD_LCM_H - -#include <__assert> -#include <__bit/countr.h> -#include <__config> -#include <__memory/addressof.h> -#include <__type_traits/common_type.h> -#include <__type_traits/is_integral.h> -#include <__type_traits/is_same.h> -#include <__type_traits/is_signed.h> -#include <__type_traits/make_unsigned.h> -#include <__type_traits/remove_cv.h> -#include <limits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -template <class _Result, class _Source> -constexpr _LIBCPP_HIDE_FROM_ABI _Result __abs_in_type(_Source __t) noexcept { - if constexpr (is_signed_v<_Source>) { - if (__t >= 0) - return __t; - if (__t == numeric_limits<_Source>::min()) - return -static_cast<_Result>(__t); - return -__t; - } else { - return __t; - } -} - -template <class _Tp, class _Up> -constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) { - static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to gcd must be integer types"); - static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to gcd cannot be bool"); - static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to gcd cannot be bool"); - using _Rp = common_type_t<_Tp, _Up>; - using _Wp = make_unsigned_t<_Rp>; - - // Using Binary GCD algorithm https://en.wikipedia.org/wiki/Binary_GCD_algorithm, based on an implementation - // from https://lemire.me/blog/2024/04/13/greatest-common-divisor-the-extended-euclidean-algorithm-and-speed/ - // - // If power of two divides both numbers, we can push it out. - // - gcd( 2^x * a, 2^x * b) = 2^x * gcd(a, b) - // - // If and only if exactly one number is even, we can divide that number by that power. - // - if a, b are odd, then gcd(2^x * a, b) = gcd(a, b) - // - // And standard gcd algorithm where instead of modulo, minus is used. - - auto __a = static_cast<_Wp>(std::__abs_in_type<_Rp>(__m)); - auto __b = static_cast<_Wp>(std::__abs_in_type<_Rp>(__n)); - - if (__a < __b) { - _Wp __tmp = __b; - __b = __a; - __a = __tmp; - } - if (__b == 0) - return static_cast<_Rp>(__a); - __a %= __b; // Make both argument of the same size, and early result in the easy case. - if (__a == 0) - return static_cast<_Rp>(__b); - - _Wp __c = __a | __b; - int __shift = std::__countr_zero(__c); - __a >>= std::__countr_zero(__a); - do { - _Wp __t = __b >> std::__countr_zero(__b); - if (__a > __t) { - __b = __a - __t; - __a = __t; - } else { - __b = __t - __a; - } - } while (__b != 0); - return static_cast<_Rp>(__a << __shift); -} - -template <class _Tp, class _Up> -constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up __n) { - static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to lcm must be integer types"); - static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to lcm cannot be bool"); - static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to lcm cannot be bool"); - if (__m == 0 || __n == 0) - return 0; - - using _Rp = common_type_t<_Tp, _Up>; - _Rp __val1 = std::__abs_in_type<_Rp>(__m) / std::gcd(__m, __n); - _Rp __val2 = std::__abs_in_type<_Rp>(__n); - _Rp __res; - [[maybe_unused]] bool __overflow = __builtin_mul_overflow(__val1, __val2, std::addressof(__res)); - _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__overflow, "Overflow in lcm"); - return __res; -} - -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_GCD_LCM_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/inclusive_scan.h b/third_party/libcxx/include/c++/v1/__numeric/inclusive_scan.h deleted file mode 100644 index d714f10..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/inclusive_scan.h +++ /dev/null @@ -1,59 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_INCLUSIVE_SCAN_H -#define _LIBCPP___NUMERIC_INCLUSIVE_SCAN_H - -#include <__config> -#include <__functional/operations.h> -#include <__iterator/iterator_traits.h> -#include <__utility/move.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator -inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _Tp __init) { - for (; __first != __last; ++__first, (void)++__result) { - __init = __b(__init, *__first); - *__result = __init; - } - return __result; -} - -template <class _InputIterator, class _OutputIterator, class _BinaryOp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator -inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b) { - if (__first != __last) { - typename iterator_traits<_InputIterator>::value_type __init = *__first; - *__result++ = __init; - if (++__first != __last) - return std::inclusive_scan(__first, __last, __result, __b, __init); - } - - return __result; -} - -template <class _InputIterator, class _OutputIterator> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator -inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { - return std::inclusive_scan(__first, __last, __result, std::plus<>()); -} - -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___NUMERIC_INCLUSIVE_SCAN_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/inner_product.h b/third_party/libcxx/include/c++/v1/__numeric/inner_product.h deleted file mode 100644 index 0deab3d..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/inner_product.h +++ /dev/null @@ -1,58 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_INNER_PRODUCT_H -#define _LIBCPP___NUMERIC_INNER_PRODUCT_H - -#include <__config> -#include <__utility/move.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _InputIterator1, class _InputIterator2, class _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp -inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { - for (; __first1 != __last1; ++__first1, (void)++__first2) -#if _LIBCPP_STD_VER >= 20 - __init = std::move(__init) + *__first1 * *__first2; -#else - __init = __init + *__first1 * *__first2; -#endif - return __init; -} - -template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp inner_product( - _InputIterator1 __first1, - _InputIterator1 __last1, - _InputIterator2 __first2, - _Tp __init, - _BinaryOperation1 __binary_op1, - _BinaryOperation2 __binary_op2) { - for (; __first1 != __last1; ++__first1, (void)++__first2) -#if _LIBCPP_STD_VER >= 20 - __init = __binary_op1(std::move(__init), __binary_op2(*__first1, *__first2)); -#else - __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); -#endif - return __init; -} - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_INNER_PRODUCT_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/iota.h b/third_party/libcxx/include/c++/v1/__numeric/iota.h deleted file mode 100644 index 27bd84e..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/iota.h +++ /dev/null @@ -1,30 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_IOTA_H -#define _LIBCPP___NUMERIC_IOTA_H - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _ForwardIterator, class _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void -iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) { - for (; __first != __last; ++__first, (void)++__value) - *__first = __value; -} - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___NUMERIC_IOTA_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/midpoint.h b/third_party/libcxx/include/c++/v1/__numeric/midpoint.h deleted file mode 100644 index d8e73ab..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/midpoint.h +++ /dev/null @@ -1,83 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_MIDPOINT_H -#define _LIBCPP___NUMERIC_MIDPOINT_H - -#include <__config> -#include <__cstddef/ptrdiff_t.h> -#include <__type_traits/is_floating_point.h> -#include <__type_traits/is_integral.h> -#include <__type_traits/is_object.h> -#include <__type_traits/is_same.h> -#include <__type_traits/is_void.h> -#include <__type_traits/make_unsigned.h> -#include <__type_traits/remove_cv.h> -#include <limits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 -template <class _Tp> - requires(is_integral_v<_Tp> && !is_same_v<remove_cv_t<_Tp>, bool>) -[[nodiscard]] -_LIBCPP_HIDE_FROM_ABI constexpr _Tp midpoint(_Tp __a, _Tp __b) noexcept _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { - using _Up = make_unsigned_t<_Tp>; - constexpr _Up __bitshift = numeric_limits<_Up>::digits - 1; - - _Up __diff = _Up(__b) - _Up(__a); - _Up __sign_bit = __b < __a; - - _Up __half_diff = (__diff / 2) + (__sign_bit << __bitshift) + (__sign_bit & __diff); - - return __a + __half_diff; -} - -template <class _Tp> - requires(is_object_v<_Tp> && (sizeof(_Tp) > 0)) -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* midpoint(_Tp* __a, _Tp* __b) noexcept { - return __a + std::midpoint(ptrdiff_t(0), __b - __a); -} - -template <typename _Fp> -_LIBCPP_HIDE_FROM_ABI constexpr _Fp __fp_abs(_Fp __f) { - return __f >= 0 ? __f : -__f; -} - -template <class _Fp> - requires(is_floating_point_v<_Fp>) -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Fp midpoint(_Fp __a, _Fp __b) noexcept { - constexpr _Fp __lo = numeric_limits<_Fp>::min() * 2; - constexpr _Fp __hi = numeric_limits<_Fp>::max() / 2; - - // typical case: overflow is impossible - if (std::__fp_abs(__a) <= __hi && std::__fp_abs(__b) <= __hi) - return (__a + __b) / 2; // always correctly rounded - if (std::__fp_abs(__a) < __lo) - return __a + __b / 2; // not safe to halve a - if (std::__fp_abs(__b) < __lo) - return __a / 2 + __b; // not safe to halve b - - return __a / 2 + __b / 2; // otherwise correctly rounded -} - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_MIDPOINT_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/partial_sum.h b/third_party/libcxx/include/c++/v1/__numeric/partial_sum.h deleted file mode 100644 index 7c3cf7f..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/partial_sum.h +++ /dev/null @@ -1,66 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_PARTIAL_SUM_H -#define _LIBCPP___NUMERIC_PARTIAL_SUM_H - -#include <__config> -#include <__iterator/iterator_traits.h> -#include <__utility/move.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _InputIterator, class _OutputIterator> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator -partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { - if (__first != __last) { - typename iterator_traits<_InputIterator>::value_type __t(*__first); - *__result = __t; - for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) { -#if _LIBCPP_STD_VER >= 20 - __t = std::move(__t) + *__first; -#else - __t = __t + *__first; -#endif - *__result = __t; - } - } - return __result; -} - -template <class _InputIterator, class _OutputIterator, class _BinaryOperation> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator -partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) { - if (__first != __last) { - typename iterator_traits<_InputIterator>::value_type __t(*__first); - *__result = __t; - for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) { -#if _LIBCPP_STD_VER >= 20 - __t = __binary_op(std::move(__t), *__first); -#else - __t = __binary_op(__t, *__first); -#endif - *__result = __t; - } - } - return __result; -} - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_PARTIAL_SUM_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/pstl.h b/third_party/libcxx/include/c++/v1/__numeric/pstl.h deleted file mode 100644 index fe7b2cc..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/pstl.h +++ /dev/null @@ -1,174 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_PSTL_H -#define _LIBCPP___NUMERIC_PSTL_H - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -#if _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 - -# include <__functional/identity.h> -# include <__functional/operations.h> -# include <__iterator/cpp17_iterator_concepts.h> -# include <__iterator/iterator_traits.h> -# include <__pstl/backend.h> -# include <__pstl/dispatch.h> -# include <__pstl/handle_exception.h> -# include <__type_traits/enable_if.h> -# include <__type_traits/is_execution_policy.h> -# include <__type_traits/remove_cvref.h> -# include <__utility/forward.h> -# include <__utility/move.h> - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _ExecutionPolicy, - class _ForwardIterator, - class _Tp, - class _BinaryOperation, - class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, - enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> -_LIBCPP_HIDE_FROM_ABI _Tp reduce( - _ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init, _BinaryOperation __op) { - _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators"); - using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>; - return __pstl::__handle_exception<_Implementation>( - std::forward<_ExecutionPolicy>(__policy), - std::move(__first), - std::move(__last), - std::move(__init), - std::move(__op)); -} - -template <class _ExecutionPolicy, - class _ForwardIterator, - class _Tp, - class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, - enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> -_LIBCPP_HIDE_FROM_ABI _Tp -reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init) { - _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators"); - using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>; - return __pstl::__handle_exception<_Implementation>( - std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__init), plus{}); -} - -template <class _ExecutionPolicy, - class _ForwardIterator, - class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, - enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> -_LIBCPP_HIDE_FROM_ABI __iterator_value_type<_ForwardIterator> -reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last) { - _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators"); - using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>; - return __pstl::__handle_exception<_Implementation>( - std::forward<_ExecutionPolicy>(__policy), - std::move(__first), - std::move(__last), - __iterator_value_type<_ForwardIterator>(), - plus{}); -} - -template <class _ExecutionPolicy, - class _ForwardIterator1, - class _ForwardIterator2, - class _Tp, - class _BinaryOperation1, - class _BinaryOperation2, - class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, - enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> -_LIBCPP_HIDE_FROM_ABI _Tp transform_reduce( - _ExecutionPolicy&& __policy, - _ForwardIterator1 __first1, - _ForwardIterator1 __last1, - _ForwardIterator2 __first2, - _Tp __init, - _BinaryOperation1 __reduce, - _BinaryOperation2 __transform) { - _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "transform_reduce requires ForwardIterators"); - _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "transform_reduce requires ForwardIterators"); - using _Implementation = - __pstl::__dispatch<__pstl::__transform_reduce_binary, __pstl::__current_configuration, _RawPolicy>; - return __pstl::__handle_exception<_Implementation>( - std::forward<_ExecutionPolicy>(__policy), - std::move(__first1), - std::move(__last1), - std::move(__first2), - std::move(__init), - std::move(__reduce), - std::move(__transform)); -} - -// This overload doesn't get a customization point because it's trivial to detect (through e.g. -// __desugars_to_v) when specializing the more general variant, which should always be preferred -template <class _ExecutionPolicy, - class _ForwardIterator1, - class _ForwardIterator2, - class _Tp, - class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, - enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> -_LIBCPP_HIDE_FROM_ABI _Tp transform_reduce( - _ExecutionPolicy&& __policy, - _ForwardIterator1 __first1, - _ForwardIterator1 __last1, - _ForwardIterator2 __first2, - _Tp __init) { - _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "transform_reduce requires ForwardIterators"); - _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "transform_reduce requires ForwardIterators"); - using _Implementation = - __pstl::__dispatch<__pstl::__transform_reduce_binary, __pstl::__current_configuration, _RawPolicy>; - return __pstl::__handle_exception<_Implementation>( - std::forward<_ExecutionPolicy>(__policy), - std::move(__first1), - std::move(__last1), - std::move(__first2), - std::move(__init), - plus{}, - multiplies{}); -} - -template <class _ExecutionPolicy, - class _ForwardIterator, - class _Tp, - class _BinaryOperation, - class _UnaryOperation, - class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, - enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> -_LIBCPP_HIDE_FROM_ABI _Tp transform_reduce( - _ExecutionPolicy&& __policy, - _ForwardIterator __first, - _ForwardIterator __last, - _Tp __init, - _BinaryOperation __reduce, - _UnaryOperation __transform) { - _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "transform_reduce requires ForwardIterators"); - using _Implementation = __pstl::__dispatch<__pstl::__transform_reduce, __pstl::__current_configuration, _RawPolicy>; - return __pstl::__handle_exception<_Implementation>( - std::forward<_ExecutionPolicy>(__policy), - std::move(__first), - std::move(__last), - std::move(__init), - std::move(__reduce), - std::move(__transform)); -} - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17 - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_PSTL_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/ranges_iota.h b/third_party/libcxx/include/c++/v1/__numeric/ranges_iota.h deleted file mode 100644 index bf53dd8..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/ranges_iota.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_RANGES_IOTA_H -#define _LIBCPP___NUMERIC_RANGES_IOTA_H - -#include <__algorithm/out_value_result.h> -#include <__config> -#include <__iterator/concepts.h> -#include <__ranges/access.h> -#include <__ranges/concepts.h> -#include <__ranges/dangling.h> -#include <__utility/as_const.h> -#include <__utility/move.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 23 -namespace ranges { -template <typename _Out, typename _Tp> -using iota_result = ranges::out_value_result<_Out, _Tp>; - -struct __iota_fn { -public: - template <input_or_output_iterator _Out, sentinel_for<_Out> _Sent, weakly_incrementable _Tp> - requires indirectly_writable<_Out, const _Tp&> - _LIBCPP_HIDE_FROM_ABI static constexpr iota_result<_Out, _Tp> operator()(_Out __first, _Sent __last, _Tp __value) { - while (__first != __last) { - *__first = std::as_const(__value); - ++__first; - ++__value; - } - return {std::move(__first), std::move(__value)}; - } - - template <weakly_incrementable _Tp, ranges::output_range<const _Tp&> _Range> - _LIBCPP_HIDE_FROM_ABI static constexpr iota_result<ranges::borrowed_iterator_t<_Range>, _Tp> - operator()(_Range&& __r, _Tp __value) { - return operator()(ranges::begin(__r), ranges::end(__r), std::move(__value)); - } -}; - -inline constexpr auto iota = __iota_fn{}; -} // namespace ranges - -#endif // _LIBCPP_STD_VER >= 23 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_RANGES_IOTA_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/reduce.h b/third_party/libcxx/include/c++/v1/__numeric/reduce.h deleted file mode 100644 index 6c205bf..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/reduce.h +++ /dev/null @@ -1,53 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_REDUCE_H -#define _LIBCPP___NUMERIC_REDUCE_H - -#include <__config> -#include <__functional/operations.h> -#include <__iterator/iterator_traits.h> -#include <__utility/move.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 -template <class _InputIterator, class _Tp, class _BinaryOp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp -reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) { - for (; __first != __last; ++__first) - __init = __b(std::move(__init), *__first); - return __init; -} - -template <class _InputIterator, class _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp -reduce(_InputIterator __first, _InputIterator __last, _Tp __init) { - return std::reduce(__first, __last, __init, std::plus<>()); -} - -template <class _InputIterator> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename iterator_traits<_InputIterator>::value_type -reduce(_InputIterator __first, _InputIterator __last) { - return std::reduce(__first, __last, typename iterator_traits<_InputIterator>::value_type{}); -} -#endif - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_REDUCE_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/saturation_arithmetic.h b/third_party/libcxx/include/c++/v1/__numeric/saturation_arithmetic.h deleted file mode 100644 index 34f784e..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/saturation_arithmetic.h +++ /dev/null @@ -1,154 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H -#define _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H - -#include <__assert> -#include <__config> -#include <__memory/addressof.h> -#include <__type_traits/integer_traits.h> -#include <__utility/cmp.h> -#include <limits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -template <__signed_or_unsigned_integer _Tp> -_LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_add(_Tp __x, _Tp __y) noexcept { -# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2101 - return __builtin_elementwise_add_sat(__x, __y); -# else - if (_Tp __sum; !__builtin_add_overflow(__x, __y, std::addressof(__sum))) - return __sum; - // Handle overflow - if constexpr (__unsigned_integer<_Tp>) { - return std::numeric_limits<_Tp>::max(); - } else { - // Signed addition overflow - if (__x > 0) - // Overflows if (x > 0 && y > 0) - return std::numeric_limits<_Tp>::max(); - else - // Overflows if (x < 0 && y < 0) - return std::numeric_limits<_Tp>::min(); - } -# endif -} - -template <__signed_or_unsigned_integer _Tp> -_LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_sub(_Tp __x, _Tp __y) noexcept { -# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2101 - return __builtin_elementwise_sub_sat(__x, __y); -# else - if (_Tp __sub; !__builtin_sub_overflow(__x, __y, std::addressof(__sub))) - return __sub; - // Handle overflow - if constexpr (__unsigned_integer<_Tp>) { - // Overflows if (x < y) - return std::numeric_limits<_Tp>::min(); - } else { - // Signed subtration overflow - if (__x >= 0) - // Overflows if (x >= 0 && y < 0) - return std::numeric_limits<_Tp>::max(); - else - // Overflows if (x < 0 && y > 0) - return std::numeric_limits<_Tp>::min(); - } -# endif -} - -template <__signed_or_unsigned_integer _Tp> -_LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_mul(_Tp __x, _Tp __y) noexcept { - if (_Tp __mul; !__builtin_mul_overflow(__x, __y, std::addressof(__mul))) - return __mul; - // Handle overflow - if constexpr (__unsigned_integer<_Tp>) { - return std::numeric_limits<_Tp>::max(); - } else { - // Signed multiplication overflow - if ((__x > 0 && __y > 0) || (__x < 0 && __y < 0)) - return std::numeric_limits<_Tp>::max(); - // Overflows if (x < 0 && y > 0) || (x > 0 && y < 0) - return std::numeric_limits<_Tp>::min(); - } -} - -template <__signed_or_unsigned_integer _Tp> -_LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_div(_Tp __x, _Tp __y) noexcept { - _LIBCPP_ASSERT_UNCATEGORIZED(__y != 0, "Division by 0 is undefined"); - if constexpr (__unsigned_integer<_Tp>) { - return __x / __y; - } else { - // Handle signed division overflow - if (__x == std::numeric_limits<_Tp>::min() && __y == _Tp{-1}) - return std::numeric_limits<_Tp>::max(); - return __x / __y; - } -} - -template <__signed_or_unsigned_integer _Rp, __signed_or_unsigned_integer _Tp> -_LIBCPP_HIDE_FROM_ABI constexpr _Rp __saturating_cast(_Tp __x) noexcept { - // Saturation is impossible edge case when ((min _Rp) < (min _Tp) && (max _Rp) > (max _Tp)) and it is expected to be - // optimized out by the compiler. - - // Handle overflow - if (std::cmp_less(__x, std::numeric_limits<_Rp>::min())) - return std::numeric_limits<_Rp>::min(); - if (std::cmp_greater(__x, std::numeric_limits<_Rp>::max())) - return std::numeric_limits<_Rp>::max(); - // No overflow - return static_cast<_Rp>(__x); -} - -#endif // _LIBCPP_STD_VER >= 20 - -#if _LIBCPP_STD_VER >= 26 - -template <__signed_or_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_add(_Tp __x, _Tp __y) noexcept { - return std::__saturating_add(__x, __y); -} - -template <__signed_or_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_sub(_Tp __x, _Tp __y) noexcept { - return std::__saturating_sub(__x, __y); -} - -template <__signed_or_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_mul(_Tp __x, _Tp __y) noexcept { - return std::__saturating_mul(__x, __y); -} - -template <__signed_or_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_div(_Tp __x, _Tp __y) noexcept { - return std::__saturating_div(__x, __y); -} - -template <__signed_or_unsigned_integer _Rp, __signed_or_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Rp saturating_cast(_Tp __x) noexcept { - return std::__saturating_cast<_Rp>(__x); -} - -#endif // _LIBCPP_STD_VER >= 26 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/transform_exclusive_scan.h b/third_party/libcxx/include/c++/v1/__numeric/transform_exclusive_scan.h deleted file mode 100644 index fb88aa5..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/transform_exclusive_scan.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_H -#define _LIBCPP___NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_H - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_exclusive_scan( - _InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init, _BinaryOp __b, _UnaryOp __u) { - if (__first != __last) { - _Tp __saved = __init; - do { - __init = __b(__init, __u(*__first)); - *__result = __saved; - __saved = __init; - ++__result; - } while (++__first != __last); - } - return __result; -} - -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/transform_inclusive_scan.h b/third_party/libcxx/include/c++/v1/__numeric/transform_inclusive_scan.h deleted file mode 100644 index 2eab1a1..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/transform_inclusive_scan.h +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_TRANSFORM_INCLUSIVE_SCAN_H -#define _LIBCPP___NUMERIC_TRANSFORM_INCLUSIVE_SCAN_H - -#include <__config> -#include <__iterator/iterator_traits.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_inclusive_scan( - _InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init) { - for (; __first != __last; ++__first, (void)++__result) { - __init = __b(__init, __u(*__first)); - *__result = __init; - } - - return __result; -} - -template <class _InputIterator, class _OutputIterator, class _BinaryOp, class _UnaryOp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_inclusive_scan( - _InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _UnaryOp __u) { - if (__first != __last) { - typename iterator_traits<_InputIterator>::value_type __init = __u(*__first); - *__result++ = __init; - if (++__first != __last) - return std::transform_inclusive_scan(__first, __last, __result, __b, __u, __init); - } - - return __result; -} - -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___NUMERIC_TRANSFORM_INCLUSIVE_SCAN_H diff --git a/third_party/libcxx/include/c++/v1/__numeric/transform_reduce.h b/third_party/libcxx/include/c++/v1/__numeric/transform_reduce.h deleted file mode 100644 index f115051..0000000 --- a/third_party/libcxx/include/c++/v1/__numeric/transform_reduce.h +++ /dev/null @@ -1,59 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___NUMERIC_TRANSFORM_REDUCE_H -#define _LIBCPP___NUMERIC_TRANSFORM_REDUCE_H - -#include <__config> -#include <__functional/operations.h> -#include <__utility/move.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 -template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp -transform_reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b, _UnaryOp __u) { - for (; __first != __last; ++__first) - __init = __b(std::move(__init), __u(*__first)); - return __init; -} - -template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOp1, class _BinaryOp2> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce( - _InputIterator1 __first1, - _InputIterator1 __last1, - _InputIterator2 __first2, - _Tp __init, - _BinaryOp1 __b1, - _BinaryOp2 __b2) { - for (; __first1 != __last1; ++__first1, (void)++__first2) - __init = __b1(std::move(__init), __b2(*__first1, *__first2)); - return __init; -} - -template <class _InputIterator1, class _InputIterator2, class _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp -transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { - return std::transform_reduce(__first1, __last1, __first2, std::move(__init), std::plus<>(), std::multiplies<>()); -} -#endif - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___NUMERIC_TRANSFORM_REDUCE_H |
