Skip to content

Commit

Permalink
Some sanitization for MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
rroelke committed Jan 7, 2025
1 parent 50e81c2 commit aec3e05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tiledb/common/algorithm/parallel_merge.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ class ParallelMerge {

bool operator()(
const std::span<const T> l, const std::span<const T> r) const {
return !(cmp_(l.front(), r.front()));
// note that this flips the comparison as it is used in a max heap but we want min
return cmp_(r.front(), l.front());
}

Compare cmp_;
Expand Down
5 changes: 3 additions & 2 deletions tiledb/common/algorithm/test/unit_parallel_merge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ struct VerifyTournamentMerge {

// SAFETY: the merge unit will begin writing at index
// `unit.output_start()`
T* output_ptr = &output[-unit.output_start()];
T* output_buffer = output.data();
T* output_ptr = output_buffer - unit.output_start();

std::vector<std::span<T>> spans;
for (size_t s = 0; s < streams.size(); s++) {
Expand Down Expand Up @@ -297,7 +298,7 @@ struct VerifyParallelMerge {

ThreadPool pool(pool_concurrency);
auto future =
parallel_merge(pool, resources, options, spans, cmp, &output[0]);
parallel_merge(pool, resources, options, spans, cmp, &output.data()[0]);

std::optional<uint64_t> prev_bound;
std::optional<uint64_t> bound;
Expand Down

0 comments on commit aec3e05

Please sign in to comment.