From cbce23fb86705aff7f9f1294a295027d7ed674ef Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Wed, 11 Nov 2015 17:44:12 -0500 Subject: [PATCH] Leave decltype(max_ulps_) alone and cast, not sure this is better --- googlemock/test/gmock-matchers_test.cc | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 8cc37e72..11b6de2d 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -2708,19 +2708,21 @@ class FloatingPointTest : public testing::Test { zero_bits_(Floating(0).bits()), one_bits_(Floating(1).bits()), infinity_bits_(Floating(Floating::Infinity()).bits()), - close_to_positive_zero_( - Floating::ReinterpretBits(zero_bits_ + max_ulps_/2)), - close_to_negative_zero_( - -Floating::ReinterpretBits(zero_bits_ + max_ulps_ - max_ulps_/2)), + close_to_positive_zero_(Floating::ReinterpretBits( + static_cast(zero_bits_ + max_ulps_/2))), + close_to_negative_zero_(-Floating::ReinterpretBits( + static_cast(zero_bits_ + max_ulps_ - max_ulps_/2))), further_from_negative_zero_(-Floating::ReinterpretBits( - zero_bits_ + max_ulps_ + 1 - max_ulps_/2)), - close_to_one_(Floating::ReinterpretBits(one_bits_ + max_ulps_)), - further_from_one_(Floating::ReinterpretBits(one_bits_ + max_ulps_ + 1)), + static_cast(zero_bits_ + max_ulps_ + 1 - max_ulps_/2))), + close_to_one_(Floating::ReinterpretBits( + static_cast(one_bits_ + max_ulps_))), + further_from_one_(Floating::ReinterpretBits( + static_cast(one_bits_ + max_ulps_ + 1))), infinity_(Floating::Infinity()), - close_to_infinity_( - Floating::ReinterpretBits(infinity_bits_ - max_ulps_)), - further_from_infinity_( - Floating::ReinterpretBits(infinity_bits_ - max_ulps_ - 1)), + close_to_infinity_(Floating::ReinterpretBits( + static_cast(infinity_bits_ - max_ulps_))), + further_from_infinity_(Floating::ReinterpretBits( + static_cast(infinity_bits_ - max_ulps_ - 1))), max_(Floating::Max()), nan1_(Floating::ReinterpretBits(Floating::kExponentBitMask | 1)), nan2_(Floating::ReinterpretBits(Floating::kExponentBitMask | 200)) { @@ -2778,7 +2780,7 @@ class FloatingPointTest : public testing::Test { // Pre-calculated numbers to be used by the tests. - const unsigned int max_ulps_; + const size_t max_ulps_; const Bits zero_bits_; // The bits that represent 0.0. const Bits one_bits_; // The bits that represent 1.0.