| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if defined(COMPILER_MSVC) && defined(ARCH_CPU_32_BITS) | 5 #include <stddef.h> |
| 6 #include <mmintrin.h> | |
| 7 #endif | |
| 8 #include <stdint.h> | 6 #include <stdint.h> |
| 9 | 7 |
| 10 #include <limits> | 8 #include <limits> |
| 11 #include <type_traits> | 9 #include <type_traits> |
| 12 | 10 |
| 13 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 14 #include "base/numerics/safe_conversions.h" | 12 #include "base/numerics/safe_conversions.h" |
| 15 #include "base/numerics/safe_math.h" | 13 #include "base/numerics/safe_math.h" |
| 16 #include "base/template_util.h" | 14 #include "base/template_util.h" |
| 15 #include "build/build_config.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 17 |
| 18 #if defined(COMPILER_MSVC) && defined(ARCH_CPU_32_BITS) |
| 19 #include <mmintrin.h> |
| 20 #endif |
| 21 |
| 19 using std::numeric_limits; | 22 using std::numeric_limits; |
| 20 using base::CheckedNumeric; | 23 using base::CheckedNumeric; |
| 21 using base::checked_cast; | 24 using base::checked_cast; |
| 22 using base::IsValueInRangeForNumericType; | 25 using base::IsValueInRangeForNumericType; |
| 23 using base::IsValueNegative; | 26 using base::IsValueNegative; |
| 24 using base::SizeT; | 27 using base::SizeT; |
| 25 using base::StrictNumeric; | 28 using base::StrictNumeric; |
| 26 using base::saturated_cast; | 29 using base::saturated_cast; |
| 27 using base::strict_cast; | 30 using base::strict_cast; |
| 28 using base::internal::MaxExponent; | 31 using base::internal::MaxExponent; |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 | 777 |
| 775 CheckedNumeric<int> too_large = std::numeric_limits<int>::max(); | 778 CheckedNumeric<int> too_large = std::numeric_limits<int>::max(); |
| 776 EXPECT_TRUE(too_large.IsValid()); | 779 EXPECT_TRUE(too_large.IsValid()); |
| 777 too_large += d; | 780 too_large += d; |
| 778 EXPECT_FALSE(too_large.IsValid()); | 781 EXPECT_FALSE(too_large.IsValid()); |
| 779 too_large -= d; | 782 too_large -= d; |
| 780 EXPECT_FALSE(too_large.IsValid()); | 783 EXPECT_FALSE(too_large.IsValid()); |
| 781 too_large /= d; | 784 too_large /= d; |
| 782 EXPECT_FALSE(too_large.IsValid()); | 785 EXPECT_FALSE(too_large.IsValid()); |
| 783 } | 786 } |
| OLD | NEW |