Commit 77016ad7 by Tobias Fuchs

algorithms_cpp: cleanup in parallel scan

parent 8a46bcb3
...@@ -57,12 +57,12 @@ class ScanFunctor { ...@@ -57,12 +57,12 @@ class ScanFunctor {
void Action(mtapi::TaskContext&) { void Action(mtapi::TaskContext&) {
if (chunk_first_ == chunk_last_) { if (chunk_first_ == chunk_last_) {
// leaf case -> do work
if (is_first_pass_) {
ChunkDescriptor<RAIIn> chunk = partitioner_[chunk_first_]; ChunkDescriptor<RAIIn> chunk = partitioner_[chunk_first_];
RAIIn iter_in = chunk.GetFirst(); RAIIn iter_in = chunk.GetFirst();
RAIIn last_in = chunk.GetLast(); RAIIn last_in = chunk.GetLast();
RAIOut iter_out = output_iterator_; RAIOut iter_out = output_iterator_;
// leaf case -> do work
if (is_first_pass_) {
ReturnType result = transformation_(*iter_in); ReturnType result = transformation_(*iter_in);
*iter_out = result; *iter_out = result;
++iter_in; ++iter_in;
...@@ -75,10 +75,6 @@ class ScanFunctor { ...@@ -75,10 +75,6 @@ class ScanFunctor {
} }
else { else {
// Second pass // Second pass
ChunkDescriptor<RAIIn> chunk = partitioner_[chunk_first_];
RAIIn iter_in = chunk.GetFirst();
RAIIn last_in = chunk.GetLast();
RAIOut iter_out = output_iterator_;
for (; iter_in != last_in; ++iter_in, ++iter_out) { for (; iter_in != last_in; ++iter_in, ++iter_out) {
*iter_out = scan_(parent_value_, *iter_out); *iter_out = scan_(parent_value_, *iter_out);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment