Skip to content

Commit 3cba294

Browse files
committed
reduce local memory operations per suggestion from @jszuppe
1 parent bceb336 commit 3cba294

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/boost/compute/algorithm/detail/merge_sort_on_gpu.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ inline size_t bitonic_block_sort(KeyIterator keys_first,
175175
k.var<key_type>("sibling_key")) << ");\n" <<
176176
k.decl<bool>("swap") <<
177177
" = compare ^ (sibling_idx < lid) ^ direction;\n" <<
178-
"swap |= equal;\n" <<
178+
"swap = equal ? false : swap;\n" <<
179179
"my_key = swap ? sibling_key : my_key;\n";
180180
if(sort_by_key)
181181
{
@@ -229,7 +229,7 @@ inline size_t bitonic_block_sort(KeyIterator keys_first,
229229
k.var<key_type>("sibling_key")) << ");\n" <<
230230
k.decl<bool>("swap") <<
231231
" = compare ^ (sibling_idx < lid);\n" <<
232-
"swap |= equal;\n" <<
232+
"swap = equal ? false : swap;\n" <<
233233
"my_key = swap ? sibling_key : my_key;\n";
234234
if(sort_by_key)
235235
{

0 commit comments

Comments
 (0)