From a997ee5bbae0a7138f854afc5a83862282ecaa6c Mon Sep 17 00:00:00 2001 From: Vaibhav Pathak Date: Fri, 26 Jul 2024 00:25:48 +0530 Subject: [PATCH] [libc++] Fix build issues with find --- libcxx/include/__algorithm/find.h | 2 +- libcxx/include/__algorithm/min_element.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libcxx/include/__algorithm/find.h b/libcxx/include/__algorithm/find.h index 7f58dbb13a5776..8ecd53e63af21b 100644 --- a/libcxx/include/__algorithm/find.h +++ b/libcxx/include/__algorithm/find.h @@ -104,7 +104,7 @@ __find_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) // do first partial word if (__first.__ctz_ != 0) { __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); - __storage_type __dn = std::min(__clz_f, __n); + __storage_type __dn = (__clz_f < __n) ? __clz_f : __n; __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); __storage_type __b = std::__invert_if(*__first.__seg_) & __m; if (__b) diff --git a/libcxx/include/__algorithm/min_element.h b/libcxx/include/__algorithm/min_element.h index 964c3ec4f976e3..25964a9e3a52fe 100644 --- a/libcxx/include/__algorithm/min_element.h +++ b/libcxx/include/__algorithm/min_element.h @@ -11,6 +11,7 @@ #include <__algorithm/comp.h> #include <__algorithm/comp_ref_type.h> +#include <__algorithm/find.h> #include <__algorithm/iterator_operations.h> #include <__config> #include <__functional/identity.h> @@ -83,7 +84,7 @@ __min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) { __block_end = __last; } - return find(__block_start, __block_end, __min_val); + return std::__find(__block_start, __block_end, __min_val, __proj); } template