Skip to content

Commit

Permalink
Reduce the amount of content included by <array> (#482)
Browse files Browse the repository at this point in the history
* Reduce the amount of content included by <array>.

Resolves GH-462.

* Demote `back_inserter` and `iterator` to `<iterator>`.
* Demote `_Yarn` to `<xlocinfo>`.
* Demote `_Tidy_guard`, `_Tidy_deallocate_guard`, and `_Nothrow_compare` to `<xmemory>`.
* Promote `_Swap_ranges_unchecked` to `<xutility>`.
* Change `<array>` to include only `<xutility>`.

* Un-demote iterator.

* Workaround many RWC projects that expected std::min and std::max to come from <array>.

* Remove the `_STL_ASSERT` from `std::min` and `std::max`. We normally guard every `op<` with debug checks, but in this case we aren't using it to enforce something like a container invariant; the number of bad op<s we catch with it are likely microscopic.
* Delete `_Min_value` and `_Max_value` from `<utility>`.
* Move `min` and `max` to `<utility>` (in the exact position as the old `_Min_value` and `_Max_value`)
* Change all existing callers of `_Min_value` and `_Max_value` to call `(_STD min)` and `(_STD max)`, respectively.

* Homogenize vector algorithm guards.
  • Loading branch information
BillyONeal committed Feb 21, 2020
1 parent fffbd8f commit 482f1d8
Show file tree
Hide file tree
Showing 23 changed files with 323 additions and 335 deletions.
101 changes: 9 additions & 92 deletions stl/inc/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

#if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID)
_EXTERN_C
// See note about "noalias" in <xutility>
__declspec(noalias) void __cdecl __std_swap_ranges_trivially_swappable_noalias(
void* _First1, void* _Last1, void* _First2) noexcept;
_END_EXTERN_C
#endif // (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID)

_STD_BEGIN
// COMMON SORT PARAMETERS
_INLINE_VAR constexpr int _ISORT_MAX = 32; // maximum size for insertion sort
Expand All @@ -34,13 +26,13 @@ template <class _Diff>
constexpr ptrdiff_t _Temporary_buffer_size(const _Diff _Value) noexcept {
// convert an iterator difference_type to a ptrdiff_t for use in temporary buffers
using _CT = common_type_t<ptrdiff_t, _Diff>;
return static_cast<ptrdiff_t>(_Min_value(static_cast<_CT>(PTRDIFF_MAX), static_cast<_CT>(_Value)));
return static_cast<ptrdiff_t>((_STD min)(static_cast<_CT>(PTRDIFF_MAX), static_cast<_CT>(_Value)));
}

template <class _Ty>
struct _Optimistic_temporary_buffer { // temporary storage with _alloca-like attempt
static constexpr size_t _Optimistic_size = 4096; // default to ~1 page
static constexpr size_t _Optimistic_count = _Max_value(static_cast<size_t>(1), _Optimistic_size / sizeof(_Ty));
static constexpr size_t _Optimistic_count = (_STD max)(static_cast<size_t>(1), _Optimistic_size / sizeof(_Ty));

template <class _Diff>
explicit _Optimistic_temporary_buffer(const _Diff _Requested_size) noexcept { // get temporary storage
Expand Down Expand Up @@ -325,7 +317,7 @@ _NODISCARD _CONSTEXPR20 pair<_InIt1, _InIt2> mismatch(
using _CT = _Common_diff_t<_InIt1, _InIt2>;
const _CT _Count1 = _ULast1 - _UFirst1;
const _CT _Count2 = _ULast2 - _UFirst2;
const auto _Count = static_cast<_Iter_diff_t<_InIt1>>(_Min_value(_Count1, _Count2));
const auto _Count = static_cast<_Iter_diff_t<_InIt1>>((_STD min)(_Count1, _Count2));
_ULast1 = _UFirst1 + _Count;
while (_UFirst1 != _ULast1 && _Pred(*_UFirst1, *_UFirst2)) {
++_UFirst1;
Expand Down Expand Up @@ -362,7 +354,7 @@ pair<_InIt1, _InIt2> _Mismatch_unchecked(const _InIt1 _First1, const _InIt1 _Las
using _CT = _Common_diff_t<_InIt1, _InIt2>;
const _CT _Count1 = _Last1 - _First1;
const _CT _Count2 = _Last2 - _First2;
const auto _Count = static_cast<_Iter_diff_t<_InIt1>>(_Min_value(_Count1, _Count2));
const auto _Count = static_cast<_Iter_diff_t<_InIt1>>((_STD min)(_Count1, _Count2));
return _STD mismatch(_First1, _First1 + _Count, _First2, _Pred);
}

Expand Down Expand Up @@ -1261,38 +1253,7 @@ _NODISCARD _FwdIt1 find_first_of(_ExPo&& _Exec, const _FwdIt1 _First1, const _Fw
}
#endif // _HAS_CXX17


// FUNCTION TEMPLATE swap_ranges
template <class _FwdIt1, class _FwdIt2>
_CONSTEXPR20 _FwdIt2 _Swap_ranges_unchecked(_FwdIt1 _First1, const _FwdIt1 _Last1, _FwdIt2 _First2) {
// swap [_First1, _Last1) with [_First2, ...), no special optimization
for (; _First1 != _Last1; ++_First1, (void) ++_First2) {
_STD iter_swap(_First1, _First2);
}

return _First2;
}

#if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID)
template <class _Ty, enable_if_t<_Is_trivially_swappable_v<_Ty>, int> = 0>
_CONSTEXPR20 _Ty* _Swap_ranges_unchecked(_Ty* _First1, _Ty* const _Last1, _Ty* _First2) {
// swap [_First1, _Last1) with [_First2, ...), trivially swappable optimization
#ifdef __cpp_lib_is_constant_evaluated
if (!_STD is_constant_evaluated())
#endif // __cpp_lib_is_constant_evaluated
{
__std_swap_ranges_trivially_swappable_noalias(_First1, _Last1, _First2);
return _First2 + (_Last1 - _First1);
}

for (; _First1 != _Last1; ++_First1, (void) ++_First2) {
_STD iter_swap(_First1, _First2);
}

return _First2;
}
#endif // (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID)

template <class _FwdIt1, class _FwdIt2>
_CONSTEXPR20 _FwdIt2 swap_ranges(const _FwdIt1 _First1, const _FwdIt1 _Last1, _FwdIt2 _First2) {
// swap [_First1, _Last1) with [_First2, ...)
Expand Down Expand Up @@ -3365,7 +3326,7 @@ void inplace_merge(_BidIt _First, _BidIt _Mid, _BidIt _Last, _Pr _Pred) {
}

const _Diff _Count2 = _STD distance(_UMid, _ULast);
_Optimistic_temporary_buffer<_Iter_value_t<_BidIt>> _Temp_buf{_Min_value(_Count1, _Count2)};
_Optimistic_temporary_buffer<_Iter_value_t<_BidIt>> _Temp_buf{(_STD min)(_Count1, _Count2)};
_Buffered_inplace_merge_unchecked_impl(
_UFirst, _UMid, _ULast, _Count1, _Count2, _Temp_buf._Data, _Temp_buf._Capacity, _Pass_fn(_Pred));
}
Expand Down Expand Up @@ -3635,7 +3596,7 @@ void _Uninitialized_chunked_merge_unchecked(_BidIt _First, const _BidIt _Last, _
while (_Chunk < _Count) {
_Count -= _Chunk;
const _BidIt _Mid1 = _STD next(_First, _Chunk);
const auto _Chunk2 = _Min_value(_Chunk, _Count);
const auto _Chunk2 = (_STD min)(_Chunk, _Count);
_Count -= _Chunk2;
const _BidIt _Mid2 = _STD next(_Mid1, _Chunk2);
_Backout._Last = _Uninitialized_merge_move(_First, _Mid1, _Mid2, _Backout._Last, _Pred);
Expand All @@ -3655,7 +3616,7 @@ void _Chunked_merge_unchecked(_BidIt _First, const _BidIt _Last, _OutIt _Dest, c
while (_Chunk < _Count) {
_Count -= _Chunk;
const _BidIt _Mid1 = _STD next(_First, _Chunk);
const auto _Chunk2 = _Min_value(_Chunk, _Count);
const auto _Chunk2 = (_STD min)(_Chunk, _Count);
_Count -= _Chunk2;
const _BidIt _Mid2 = _STD next(_Mid1, _Chunk2);
_Dest = _Merge_move(_First, _Mid1, _Mid2, _Dest, _Pred);
Expand Down Expand Up @@ -4535,72 +4496,28 @@ _NODISCARD pair<_FwdIt, _FwdIt> minmax_element(_ExPo&&, _FwdIt _First, _FwdIt _L
}
#endif // _HAS_CXX17

// FUNCTION TEMPLATE max
template <class _Ty, class _Pr>
_NODISCARD constexpr const _Ty&(max)(const _Ty& _Left, const _Ty& _Right, _Pr _Pred) noexcept(
noexcept(_DEBUG_LT_PRED(_Pred, _Left, _Right))) /* strengthened */ {
// return larger of _Left and _Right using _Pred
return _DEBUG_LT_PRED(_Pred, _Left, _Right) ? _Right : _Left;
}

// FUNCTION TEMPLATE max (for initializer_list)
template <class _Ty, class _Pr>
_NODISCARD constexpr _Ty(max)(initializer_list<_Ty> _Ilist, _Pr _Pred) {
// return leftmost/largest
const _Ty* _Res = _Max_element_unchecked(_Ilist.begin(), _Ilist.end(), _Pass_fn(_Pred));
return *_Res;
}

#pragma warning(push)
#pragma warning(disable : 28285) // (syntax error in SAL annotation, occurs when _Ty is not an integral type)
template <class _Ty>
_NODISCARD _Post_equal_to_(_Left < _Right ? _Right : _Left) constexpr const _Ty&(max)(
const _Ty& _Left, const _Ty& _Right) noexcept(noexcept(_Left < _Right)) /* strengthened */ {
// return larger of _Left and _Right
if (_Left < _Right) {
_STL_ASSERT(!(_Right < _Left), "invalid comparator");
return _Right;
}

return _Left;
}
#pragma warning(pop)

template <class _Ty>
_NODISCARD constexpr _Ty(max)(initializer_list<_Ty> _Ilist) {
// return leftmost/largest
return (_STD max)(_Ilist, less<>());
}

// FUNCTION TEMPLATE min
template <class _Ty, class _Pr>
_NODISCARD constexpr const _Ty&(min)(const _Ty& _Left, const _Ty& _Right, _Pr _Pred) noexcept(
noexcept(_DEBUG_LT_PRED(_Pred, _Right, _Left))) /* strengthened */ {
// return smaller of _Left and _Right using _Pred
return _DEBUG_LT_PRED(_Pred, _Right, _Left) ? _Right : _Left;
}

// FUNCTION TEMPLATE min (for initializer_list)
template <class _Ty, class _Pr>
_NODISCARD constexpr _Ty(min)(initializer_list<_Ty> _Ilist, _Pr _Pred) {
// return leftmost/smallest
const _Ty* _Res = _Min_element_unchecked(_Ilist.begin(), _Ilist.end(), _Pass_fn(_Pred));
return *_Res;
}

#pragma warning(push)
#pragma warning(disable : 28285) // (syntax error in SAL annotation, occurs when _Ty is not an integral type)
template <class _Ty>
_NODISCARD _Post_equal_to_(_Right < _Left ? _Right : _Left) constexpr const _Ty&(min)(
const _Ty& _Left, const _Ty& _Right) noexcept(noexcept(_Right < _Left)) /* strengthened */ {
// return smaller of _Left and _Right
if (_Right < _Left) {
_STL_ASSERT(!(_Left < _Right), "invalid comparator");
return _Right;
}

return _Left;
}
#pragma warning(pop)

template <class _Ty>
_NODISCARD constexpr _Ty(min)(initializer_list<_Ty> _Ilist) {
// return leftmost/smallest
Expand Down
4 changes: 1 addition & 3 deletions stl/inc/array
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#define _ARRAY_
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR
#include <algorithm>
#include <iterator>
#include <tuple>
#include <xutility>

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
Expand Down
16 changes: 8 additions & 8 deletions stl/inc/charconv
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ _NODISCARD inline bool _Multiply_by_power_of_ten(_Big_integer_flt& _Xval, const

for (uint32_t _Large_power = _Power / 10; _Large_power != 0;) {
const uint32_t _Current_power =
_Min_value(_Large_power, static_cast<uint32_t>(_STD size(_Large_power_indices)));
(_STD min)(_Large_power, static_cast<uint32_t>(_STD size(_Large_power_indices)));

const _Unpack_index& _Index = _Large_power_indices[_Current_power - 1];
_Big_integer_flt _Multiplier{};
Expand Down Expand Up @@ -1504,8 +1504,8 @@ _NODISCARD errc _Convert_decimal_string_to_floating_type(
// fractional part. If the exponent is positive, then the integer part consists of the first 'exponent' digits,
// or all present digits if there are fewer digits. If the exponent is zero or negative, then the integer part
// is empty. In either case, the remaining digits form the fractional part of the mantissa.
const uint32_t _Positive_exponent = static_cast<uint32_t>(_Max_value(0, _Data._Myexponent));
const uint32_t _Integer_digits_present = _Min_value(_Positive_exponent, _Data._Mymantissa_count);
const uint32_t _Positive_exponent = static_cast<uint32_t>((_STD max)(0, _Data._Myexponent));
const uint32_t _Integer_digits_present = (_STD min)(_Positive_exponent, _Data._Mymantissa_count);
const uint32_t _Integer_digits_missing = _Positive_exponent - _Integer_digits_present;
const uint8_t* const _Integer_first = _Data._Mymantissa;
const uint8_t* const _Integer_last = _Data._Mymantissa + _Integer_digits_present;
Expand Down Expand Up @@ -1767,7 +1767,7 @@ _NODISCARD from_chars_result _Ordinary_floating_from_chars(const char* const _Fi
// For "03333.111", it is 4.
// For "00000.111", it is 0.
// For "00000.001", it is -2.
int _Exponent_adjustment = static_cast<int>(_Min_value(_Whole_end - _Leading_zero_end, _Maximum_adjustment));
int _Exponent_adjustment = static_cast<int>((_STD min)(_Whole_end - _Leading_zero_end, _Maximum_adjustment));

// [_Whole_end, _Dot_end) will contain 0 or 1 '.' characters
if (_Next != _Last && *_Next == '.') {
Expand All @@ -1783,7 +1783,7 @@ _NODISCARD from_chars_result _Ordinary_floating_from_chars(const char* const _Fi
for (; _Next != _Last && *_Next == '0'; ++_Next) {
}

_Exponent_adjustment = static_cast<int>(_Max_value(_Dot_end - _Next, _Minimum_adjustment));
_Exponent_adjustment = static_cast<int>((_STD max)(_Dot_end - _Next, _Minimum_adjustment));
}

// Scan the fractional part of the mantissa:
Expand Down Expand Up @@ -2869,7 +2869,7 @@ _NODISCARD inline to_chars_result _Floating_to_chars_general_precision(
_Table_end = _Table_begin + _Precision + 5;
} else {
_Table_begin = _Tables::_Ordinary_X_table;
_Table_end = _Table_begin + _Min_value(_Precision, _Tables::_Max_P) + 5;
_Table_end = _Table_begin + (_STD min)(_Precision, _Tables::_Max_P) + 5;
}

// Profiling indicates that linear search is faster than binary search for small tables.
Expand Down Expand Up @@ -2916,13 +2916,13 @@ _NODISCARD inline to_chars_result _Floating_to_chars_general_precision(
// Write into the local buffer.
// Clamping _Effective_precision allows _Buffer to be as small as possible, and increases efficiency.
if (_Use_fixed_notation) {
_Effective_precision = _Min_value(_Precision - (_Scientific_exponent_X + 1), _Max_fixed_precision);
_Effective_precision = (_STD min)(_Precision - (_Scientific_exponent_X + 1), _Max_fixed_precision);
const to_chars_result _Buf_result =
_Floating_to_chars_fixed_precision(_Buffer, _STD end(_Buffer), _Value, _Effective_precision);
_STL_INTERNAL_CHECK(_Buf_result.ec == errc{});
_Significand_last = _Buf_result.ptr;
} else {
_Effective_precision = _Min_value(_Precision - 1, _Max_scientific_precision);
_Effective_precision = (_STD min)(_Precision - 1, _Max_scientific_precision);
const to_chars_result _Buf_result =
_Floating_to_chars_scientific_precision(_Buffer, _STD end(_Buffer), _Value, _Effective_precision);
_STL_INTERNAL_CHECK(_Buf_result.ec == errc{});
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/deque
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ public:
}

_NODISCARD size_type max_size() const noexcept {
return _Min_value(
return (_STD min)(
static_cast<size_type>((numeric_limits<difference_type>::max)()), _Alty_traits::max_size(_Getal()));
}

Expand Down Expand Up @@ -1175,7 +1175,7 @@ public:
_Orphan_all();
auto _Myfirst = _Unchecked_begin();
const auto _Oldsize = _Mysize();
auto _Assign_count = _Min_value(_Count, _Oldsize);
auto _Assign_count = (_STD min)(_Count, _Oldsize);
for (; 0 < _Assign_count; --_Assign_count) {
*_Myfirst = _Val;
++_Myfirst;
Expand Down
16 changes: 8 additions & 8 deletions stl/inc/execution
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public:
}

void _Submit_for_chunks(const size_t _Hw_threads, const size_t _Chunks) const noexcept {
_Submit(_Min_value(_Hw_threads * _Oversubmission_multiplier, _Chunks));
_Submit((_STD min)(_Hw_threads * _Oversubmission_multiplier, _Chunks));
}

private:
Expand Down Expand Up @@ -229,7 +229,7 @@ constexpr size_t _Get_chunked_work_chunk_count(const size_t _Hw_threads, const _
// get the number of chunks to break work into to parallelize
const auto _Size_count = static_cast<size_t>(_Count); // no overflow due to forward iterators
// we assume _Hw_threads * _Oversubscription_multiplier does not overflow
return _Min_value(_Hw_threads * _Oversubscription_multiplier, _Size_count);
return (_STD min)(_Hw_threads * _Oversubscription_multiplier, _Size_count);
}

// FUNCTION TEMPLATE _Get_least2_chunked_work_chunk_count
Expand Down Expand Up @@ -797,7 +797,7 @@ struct _Static_partition_team { // common data for all static partitioned ops

_Diff _Get_chunk_offset(const size_t _This_chunk) const {
const auto _This_chunk_diff = static_cast<_Diff>(_This_chunk);
return _This_chunk_diff * _Chunk_size + _Min_value(_This_chunk_diff, _Unchunked_items);
return _This_chunk_diff * _Chunk_size + (_STD min)(_This_chunk_diff, _Unchunked_items);
}

_Static_partition_key<_Diff> _Get_next_key() {
Expand Down Expand Up @@ -1026,7 +1026,7 @@ _Common_diff_t<_InIt1, _InIt2> _Distance_min(_InIt1 _First1, const _InIt1 _Last1
if constexpr (_Is_random_iter_v<_InIt1> && _Is_random_iter_v<_InIt2>) {
const _CT _Count1 = _Last1 - _First1;
const _CT _Count2 = _Last2 - _First2;
_Result = _Min_value(_Count1, _Count2);
_Result = (_STD min)(_Count1, _Count2);
} else if constexpr (_Is_random_iter_v<_InIt1>) {
for (auto _Count1 = _Last1 - _First1; 0 < _Count1 && _First2 != _Last2; --_Count1) {
++_First2;
Expand Down Expand Up @@ -2814,7 +2814,7 @@ struct _Static_partitioned_temporary_buffer2 {
ptrdiff_t _Get_offset(const size_t _Chunk_number) {
// get the offset of the first element of the temporary buffer allocated to chunk _Chunk_number
auto _Diff_chunk = static_cast<ptrdiff_t>(_Chunk_number);
return _Diff_chunk * _Chunk_size + _Min_value(_Diff_chunk, _Unchunked_items);
return _Diff_chunk * _Chunk_size + (_STD min)(_Diff_chunk, _Unchunked_items);
}

void _Destroy_all() { // destroy each element of the temporary buffer
Expand Down Expand Up @@ -2845,13 +2845,13 @@ inline size_t _Get_stable_sort_tree_height(const size_t _Count, const size_t _Hw
#else // ^^^ _WIN64 ^^^ // vvv !_WIN64 vvv
const size_t _Max_tree_height = 30;
#endif // _WIN64
const size_t _Clamped_ideal_chunks = _Min_value(_Max_tree_height, _Log_ideal_chunks);
const size_t _Clamped_ideal_chunks = (_STD min)(_Max_tree_height, _Log_ideal_chunks);

// similarly, if _Clamped_ideal_chunks is odd, that would break our 2 to even power invariant,
// so go to the next higher power of 2
const auto _Ideal_tree_height = _Clamped_ideal_chunks + (_Clamped_ideal_chunks & 0x1U);

return _Min_value(_Count_max_tree_height, _Ideal_tree_height);
return (_STD min)(_Count_max_tree_height, _Ideal_tree_height);
}

struct _Bottom_up_merge_tree {
Expand Down Expand Up @@ -3302,7 +3302,7 @@ struct _Static_partitioned_is_heap_until {
const auto _Chunk_offset = _Key._Start_at;
const auto _Last = _Chunk_offset + _Chunk_range_size;

const auto _Initial = _Max_value(_Chunk_offset, _Diff{1});
const auto _Initial = (_STD max)(_Chunk_offset, _Diff{1});
for (_Diff _Off = _Initial; _Off < _Last; ++_Off) {
if (_DEBUG_LT_PRED(_Pred, *(_Range_first + ((_Off - 1) >> 1)), *(_Range_first + _Off))) {
_Results._Imbue(_Key._Chunk_number, _Range_first + _Off);
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/forward_list
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ public:
}

_NODISCARD size_type max_size() const noexcept {
return _Min_value(
return (_STD min)(
static_cast<size_type>((numeric_limits<difference_type>::max)()), _Alnode_traits::max_size(_Getal()));
}

Expand Down
2 changes: 1 addition & 1 deletion stl/inc/fstream
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ protected:
const auto _Start_count = _Count;
const auto _Available = static_cast<size_t>(_Mysb::_Gnavail());
if (0 < _Available) { // copy from get area
const auto _Read_size = _Min_value(_Count_s, _Available);
const auto _Read_size = (_STD min)(_Count_s, _Available);
_Traits::copy(_Ptr, _Mysb::gptr(), _Read_size);
_Ptr += _Read_size;
_Count_s -= _Read_size;
Expand Down
6 changes: 3 additions & 3 deletions stl/inc/functional
Original file line number Diff line number Diff line change
Expand Up @@ -1821,13 +1821,13 @@ void _Build_boyer_moore_delta_2_table(_Iter_diff_t<_RanItPat>* _Shifts, const _R
for (_Diff _Idx = _Pat_size; _Idx > 0; --_Idx, (void) --_Suffix) {
_Suffix_fn[static_cast<size_t>(_Idx - 1)] = _Suffix;
while (_Suffix < _Pat_size && !_Eq(_Pat_first[_Idx - 1], _Pat_first[_Suffix])) {
_Shifts[_Suffix] = _Min_value(_Shifts[_Suffix], _Pat_size - _Idx);
_Shifts[_Suffix] = (_STD min)(_Shifts[_Suffix], _Pat_size - _Idx);
_Suffix = _Suffix_fn[static_cast<size_t>(_Suffix)];
}
}

for (_Diff _Idx = 0; _Idx <= _Suffix; ++_Idx) {
_Shifts[_Idx] = _Min_value(_Shifts[_Idx], _Pat_size + _Suffix - _Idx);
_Shifts[_Idx] = (_STD min)(_Shifts[_Idx], _Pat_size + _Suffix - _Idx);
}
}

Expand Down Expand Up @@ -1865,7 +1865,7 @@ pair<_RanItHaystack, _RanItHaystack> _Boyer_moore_search(
--_Idx;
--_UFirst;
} while (_Eq(*_UFirst, _UPat_first[_Idx]));
_Shift = _Max_value(_Delta1._Lookup(*_UFirst), _Delta2[_Idx]);
_Shift = (_STD max)(_Delta1._Lookup(*_UFirst), _Delta2[_Idx]);
}
}

Expand Down
Loading

0 comments on commit 482f1d8

Please sign in to comment.