summaryrefslogtreecommitdiff
path: root/klm/util/stream/sort.hh
diff options
context:
space:
mode:
Diffstat (limited to 'klm/util/stream/sort.hh')
-rw-r--r--klm/util/stream/sort.hh12
1 files changed, 8 insertions, 4 deletions
diff --git a/klm/util/stream/sort.hh b/klm/util/stream/sort.hh
index a86f160f..16aa6a03 100644
--- a/klm/util/stream/sort.hh
+++ b/klm/util/stream/sort.hh
@@ -365,10 +365,14 @@ template <class Compare> class BlockSorter {
// Record the size of each block in a separate file.
offsets_->Append(link->ValidSize());
void *end = static_cast<uint8_t*>(link->Get()) + link->ValidSize();
- std::sort(
- SizedIt(link->Get(), entry_size),
- SizedIt(end, entry_size),
- compare_);
+#if defined(_WIN32) || defined(_WIN64)
+ std::stable_sort
+#else
+ std::sort
+#endif
+ (SizedIt(link->Get(), entry_size),
+ SizedIt(end, entry_size),
+ compare_);
}
offsets_->FinishedAppending();
}