summaryrefslogtreecommitdiff
path: root/klm/util/stream/sort.hh
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2013-01-20 12:31:03 +0000
committerKenneth Heafield <github@kheafield.com>2013-01-20 12:31:03 +0000
commit2753c37d0b59df79be15d88222eb0f2ec6caf903 (patch)
tree47a4f376b2b96dc6dfc9e526ea31a0970beea64c /klm/util/stream/sort.hh
parent816632a5d1e3a5a24c9b3aacb4210ed8b28a9c62 (diff)
Better delimiters, cross-platform fixes
Diffstat (limited to 'klm/util/stream/sort.hh')
-rw-r--r--klm/util/stream/sort.hh5
1 files changed, 3 insertions, 2 deletions
diff --git a/klm/util/stream/sort.hh b/klm/util/stream/sort.hh
index df57fa41..a86f160f 100644
--- a/klm/util/stream/sort.hh
+++ b/klm/util/stream/sort.hh
@@ -259,8 +259,9 @@ template <class Compare, class Combine> class MergingReader {
while (in_offsets_->RemainingBlocks()) {
// Use bigger buffers if there's less remaining.
- uint64_t per_buffer = std::max(static_cast<uint64_t>(buffer_size_),
- static_cast<uint64_t>(total_memory_ / in_offsets_->RemainingBlocks()));
+ uint64_t per_buffer = static_cast<uint64_t>(std::max<std::size_t>(
+ buffer_size_,
+ static_cast<std::size_t>((static_cast<uint64_t>(total_memory_) / in_offsets_->RemainingBlocks()))));
per_buffer -= per_buffer % entry_size;
assert(per_buffer);