OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef BASE_NUMERICS_SAFE_MATH_H_ | 5 #ifndef BASE_NUMERICS_SAFE_MATH_H_ |
6 #define BASE_NUMERICS_SAFE_MATH_H_ | 6 #define BASE_NUMERICS_SAFE_MATH_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
11 #include <type_traits> | 11 #include <type_traits> |
12 | 12 |
13 #include "base/logging.h" | |
14 #include "base/numerics/safe_math_impl.h" | 13 #include "base/numerics/safe_math_impl.h" |
15 | 14 |
16 namespace base { | 15 namespace base { |
17 | 16 |
18 namespace internal { | 17 namespace internal { |
19 | 18 |
20 // CheckedNumeric implements all the logic and operators for detecting integer | 19 // CheckedNumeric implements all the logic and operators for detecting integer |
21 // boundary conditions such as overflow, underflow, and invalid conversions. | 20 // boundary conditions such as overflow, underflow, and invalid conversions. |
22 // The CheckedNumeric type implicitly converts from floating point and integer | 21 // The CheckedNumeric type implicitly converts from floating point and integer |
23 // data types, and contains overloads for basic arithmetic operations (i.e.: +, | 22 // data types, and contains overloads for basic arithmetic operations (i.e.: +, |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 276 |
278 #undef BASE_NUMERIC_ARITHMETIC_OPERATORS | 277 #undef BASE_NUMERIC_ARITHMETIC_OPERATORS |
279 | 278 |
280 } // namespace internal | 279 } // namespace internal |
281 | 280 |
282 using internal::CheckedNumeric; | 281 using internal::CheckedNumeric; |
283 | 282 |
284 } // namespace base | 283 } // namespace base |
285 | 284 |
286 #endif // BASE_NUMERICS_SAFE_MATH_H_ | 285 #endif // BASE_NUMERICS_SAFE_MATH_H_ |
OLD | NEW |