Skip to content

Commit ed2fadb

Browse files
authored
Merge pull request #728 from jszuppe/fix_727
Fix issue #727
2 parents 35aa665 + 70234dd commit ed2fadb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ inline OutputIterator scan_on_cpu(InputIterator first,
7676
k.add_arg<output_type *>(memory_object::global_memory, "block_partial_sums");
7777

7878
k <<
79-
"uint block = " <<
80-
"(uint)ceil(((float)count)/(get_global_size(0) + 1));\n" <<
79+
"uint block = (count + get_global_size(0))/(get_global_size(0) + 1);\n" <<
8180
"uint index = get_global_id(0) * block;\n" <<
8281
"uint end = min(count, index + block);\n" <<
8382
"if(index >= end) return;\n";
@@ -155,11 +154,9 @@ inline OutputIterator scan_on_cpu(InputIterator first,
155154
l.add_arg<output_type *>(memory_object::global_memory, "block_partial_sums");
156155

157156
l <<
158-
"uint block = " <<
159-
"(uint)ceil(((float)count)/(get_global_size(0) + 1));\n" <<
157+
"uint block = (count + get_global_size(0))/(get_global_size(0) + 1);\n" <<
160158
"uint index = block + get_global_id(0) * block;\n" <<
161159
"uint end = min(count, index + block);\n" <<
162-
163160
k.decl<output_type>("sum") << " = block_partial_sums[0];\n" <<
164161
"for(uint i = 0; i < get_global_id(0); i++) {\n" <<
165162
"sum = " << op(k.var<output_type>("sum"),

0 commit comments

Comments
 (0)