From f4686d27a705bd547b828693462714d31bfd21ce Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Thu, 17 Mar 2016 21:42:37 -0800 Subject: Fix a static_cast overflow in WorkSharder Shard impl. Change: 117520810 --- tensorflow/core/util/work_sharder.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tensorflow/core/util/work_sharder.cc') diff --git a/tensorflow/core/util/work_sharder.cc b/tensorflow/core/util/work_sharder.cc index dfc2c04baa..046d69a939 100644 --- a/tensorflow/core/util/work_sharder.cc +++ b/tensorflow/core/util/work_sharder.cc @@ -39,8 +39,10 @@ void Shard(int num_workers, thread::ThreadPool* workers, int64 total, // much. Let us assume each cost unit is 1ns, kMinCostPerShard=10000 // is 10us. static const int64 kMinCostPerShard = 10000; - const int num_shards = std::max( - 1, std::min(num_workers, total * cost_per_unit / kMinCostPerShard)); + const int num_shards = + std::max(1, std::min(static_cast(num_workers), + total * cost_per_unit / kMinCostPerShard)); + // Each shard contains up to "block_size" units. [0, total) is sharded // into: // [0, block_size), [block_size, 2*block_size), ... -- cgit v1.2.3