diff --git a/algorithms_cpp/include/embb/algorithms/internal/partition-inl.h b/algorithms_cpp/include/embb/algorithms/internal/partition-inl.h index 0344913..efd7e4c 100644 --- a/algorithms_cpp/include/embb/algorithms/internal/partition-inl.h +++ b/algorithms_cpp/include/embb/algorithms/internal/partition-inl.h @@ -116,8 +116,8 @@ const ChunkDescriptor if (index <= bigger_chunk_count_) { prec_elements_count = index * (standard_chunk_size_ + 1); } else { - prec_elements_count = - (standard_chunk_size_ + 1) * bigger_chunk_count_ + + prec_elements_count = + (standard_chunk_size_ + 1) * bigger_chunk_count_ + (standard_chunk_size_ * (index - bigger_chunk_count_)); } size_t cur_elements_count = (index < bigger_chunk_count_) diff --git a/algorithms_cpp/test/partitioner_test.cc b/algorithms_cpp/test/partitioner_test.cc index 37ecb64..d17cc77 100644 --- a/algorithms_cpp/test/partitioner_test.cc +++ b/algorithms_cpp/test/partitioner_test.cc @@ -133,4 +133,5 @@ void PartitionerTest::TestLargeRange() { last_value_prev = last_value; } } -} \ No newline at end of file +} +