Skip to content

Commit

Permalink
[oneDPL][ranges][merge] minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDvorskiy committed Jan 17, 2025
1 parent 8170a1c commit 189bb98
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/oneapi/dpl/pstl/algorithm_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3085,7 +3085,7 @@ __pattern_merge_2(__parallel_tag<_IsVector>, _ExecutionPolicy&& __exec, _It1 __i
}

//serial merge n elements, starting from input x and y, to [i, j) output range
auto __res = __brick_merge_2(__it_1 + __r, __it_1 + __n_1,
const auto __res = __brick_merge_2(__it_1 + __r, __it_1 + __n_1,
__it_2 + __c, __it_2 + __n_2,
__it_out + __i, __it_out + __j, __comp, _IsVector{});

Expand Down
6 changes: 3 additions & 3 deletions include/oneapi/dpl/pstl/hetero/algorithm_ranges_impl_hetero.h
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,9 @@ std::pair<oneapi::dpl::__internal::__difference_t<_Range1>, oneapi::dpl::__inter
__pattern_merge(__hetero_tag<_BackendTag> __tag, _ExecutionPolicy&& __exec, _Range1&& __rng1, _Range2&& __rng2,
_Range3&& __rng3, _Compare __comp)
{
auto __n1 = __rng1.size();
auto __n2 = __rng2.size();
if (__rng3.size() == 0)
const auto __n1 = __rng1.size();
const auto __n2 = __rng2.size();
if (__rng3.empty())
return {0, 0};

//To consider the direct copying pattern call in case just one of sequences is empty.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ __find_start_point(const _Rng1& __rng1, const _Index __rng1_from, _Index __rng1_
template <typename _Rng1, typename _Rng2, typename _Rng3, typename _Index, typename _Compare>
std::pair<oneapi::dpl::__internal::__difference_t<_Rng1>, oneapi::dpl::__internal::__difference_t<_Rng2>>
__serial_merge(const _Rng1& __rng1, const _Rng2& __rng2, _Rng3& __rng3, const _Index __start1, const _Index __start2,
const _Index __start3, const _Index __chunk, const _Index __n1, const _Index __n2, _Compare __comp, _Index __n3 = 0)
const _Index __start3, const _Index __chunk, const _Index __n1, const _Index __n2, _Compare __comp,
const _Index __n3 = 0)
{
const _Index __rng1_size = std::min<_Index>(__n1 > __start1 ? __n1 - __start1 : _Index{0}, __chunk);
const _Index __rng2_size = std::min<_Index>(__n2 > __start2 ? __n2 - __start2 : _Index{0}, __chunk);
Expand Down

0 comments on commit 189bb98

Please sign in to comment.