Skip to content

Commit 903c78b

Browse files
committed
Change the brick in __pattern_bounded_copy_if
1 parent 5370815 commit 903c78b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/oneapi/dpl/pstl/algorithm_impl.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,13 +1445,15 @@ __pattern_bounded_copy_if(__parallel_tag<_IsVector>, _ExecutionPolicy&& __exec,
14451445

14461446
__par_backend::__buffer<bool> __mask_buf(__n);
14471447
bool* __mask = __mask_buf.get();
1448-
return __internal::__except_handler([&__exec, __n, __first, __result, __pred, __mask, __n_out]() {
1448+
auto __it_pred =
1449+
[=](_RandomAccessIterator1 __it, _DifferenceType __idx) { return std::invoke(__pred, __it[__idx]); };
1450+
return __internal::__except_handler([&__exec, __n, __first, __result, __it_pred, __mask, __n_out]() {
14491451
_DifferenceType __res_in{__n}, __res_out{__n_out};
14501452
__par_backend::__parallel_strict_scan(
14511453
__backend_tag{}, std::forward<_ExecutionPolicy>(__exec), __n, _DifferenceType(0),
14521454
[=](_DifferenceType __i, _DifferenceType __len) { // Reduce
1453-
return __internal::__brick_calc_mask_1<_DifferenceType>(
1454-
__first + __i, __first + (__i + __len), __mask + __i, __pred, _IsVector{}).first;
1455+
return __internal::__brick_compute_mask(__first + __i, __len, __it_pred, __mask + __i, _IsVector{})
1456+
.first;
14551457
},
14561458
std::plus<_DifferenceType>(), // Combine
14571459
[=, &__res_in](_DifferenceType __i, _DifferenceType __len, _DifferenceType __initial) { // Scan

0 commit comments

Comments
 (0)