aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/util/overflow_test.cc
diff options
context:
space:
mode:
authorGravatar Geoffrey Irving <geoffreyi@google.com>2017-03-31 09:16:25 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-03-31 10:30:32 -0700
commit47cd4cd100800482b57d1b7755dfdcbc04969ffe (patch)
treeeeead3de19d8ff4d83b17da7f316579bdf808b0d /tensorflow/core/util/overflow_test.cc
parentbbd2047cf3a715a1431889ad8f558576a5382876 (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.cc8
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) {