diff options
author | 2017-03-31 09:16:25 -0800 | |
---|---|---|
committer | 2017-03-31 10:30:32 -0700 | |
commit | 47cd4cd100800482b57d1b7755dfdcbc04969ffe (patch) | |
tree | eeead3de19d8ff4d83b17da7f316579bdf808b0d /tensorflow/core/util/overflow_test.cc | |
parent | bbd2047cf3a715a1431889ad8f558576a5382876 (diff) |
Use a simpler threshold in MultiplyWithoutOverflow
We only need to worry about overflowing uint64, not int64.
Change: 151836590
Diffstat (limited to 'tensorflow/core/util/overflow_test.cc')
-rw-r--r-- | tensorflow/core/util/overflow_test.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tensorflow/core/util/overflow_test.cc b/tensorflow/core/util/overflow_test.cc index 627f77164e..f93ba885e6 100644 --- a/tensorflow/core/util/overflow_test.cc +++ b/tensorflow/core/util/overflow_test.cc @@ -30,8 +30,12 @@ TEST(OverflowTest, Nonnegative) { interesting.push_back(bit + 1); interesting.push_back(bit - 1); } - auto mid = static_cast<int64>(std::pow(2, 63.0 / 2)); - for (int i = -5; i < 5; i++) interesting.push_back(mid + i); + for (const int64 mid : {static_cast<int64>(1) << 32, + static_cast<int64>(std::pow(2, 63.0 / 2))}) { + for (int i = -5; i < 5; i++) { + interesting.push_back(mid + i); + } + } // Check all pairs for (auto x : interesting) { |