Skip to content

Commit

Permalink
include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_merge.h - …
Browse files Browse the repository at this point in the history
…fix review comment: rewrite to one ternary operator

Signed-off-by: Sergey Kopienko <[email protected]>
  • Loading branch information
SergeyKopienko committed Dec 18, 2024
1 parent 879b5d2 commit 00421d4
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ __serial_merge(const _Rng1& __rng1, const _Rng2& __rng2, _Rng3& __rng3, _Index _
const bool __rng1_idx_less_n1 = __rng1_idx < __rng1_idx_end;
const bool __rng2_idx_less_n2 = __rng2_idx < __rng2_idx_end;

// Logically, one of __rng1_idx_less_n1 and __rng2_idx_less_n2 should be true here
// One of __rng1_idx_less_n1 and __rng2_idx_less_n2 should be true here
// because 1) we should fill output data with elements from one of the input ranges
// 2) we calculate __rng3_idx_end as std::min<_Index>(__rng1_size + __rng2_size, __chunk);
// 2) we calculate __rng3_idx_end as std::min<_Index>(__rng1_size + __rng2_size, __chunk).
__rng3[__rng3_idx] =
__rng1_idx_less_n1 && __rng2_idx_less_n2
? (__comp(__rng2[__rng2_idx], __rng1[__rng1_idx]) ? __rng2[__rng2_idx++] : __rng1[__rng1_idx++])
: (__rng1_idx_less_n1 ? __rng1[__rng1_idx++] : __rng2[__rng2_idx++]);
(__rng1_idx_less_n1 && __rng2_idx_less_n2 && __comp(__rng2[__rng2_idx], __rng1[__rng1_idx])) ||
!__rng1_idx_less_n1
? __rng2[__rng2_idx++]
: __rng1[__rng1_idx++];
}
}

Expand Down

0 comments on commit 00421d4

Please sign in to comment.