| 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_SAFE_MATH_H_ | 5 #ifndef PDFIUM_THIRD_PARTY_BASE_SAFE_MATH_H_ |
| 6 #define BASE_SAFE_MATH_H_ | 6 #define PDFIUM_THIRD_PARTY_BASE_SAFE_MATH_H_ |
| 7 | 7 |
| 8 #include "safe_math_impl.h" | 8 #include "safe_math_impl.h" |
| 9 | 9 |
| 10 namespace pdfium { |
| 10 namespace base { | 11 namespace base { |
| 11 | |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 // CheckedNumeric implements all the logic and operators for detecting integer | 14 // CheckedNumeric implements all the logic and operators for detecting integer |
| 15 // boundary conditions such as overflow, underflow, and invalid conversions. | 15 // boundary conditions such as overflow, underflow, and invalid conversions. |
| 16 // The CheckedNumeric type implicitly converts from floating point and integer | 16 // The CheckedNumeric type implicitly converts from floating point and integer |
| 17 // data types, and contains overloads for basic arithmetic operations (i.e.: +, | 17 // data types, and contains overloads for basic arithmetic operations (i.e.: +, |
| 18 // -, *, /, %). | 18 // -, *, /, %). |
| 19 // | 19 // |
| 20 // The following methods convert from CheckedNumeric to standard numeric values: | 20 // The following methods convert from CheckedNumeric to standard numeric values: |
| 21 // IsValid() - Returns true if the underlying numeric value is valid (i.e. has | 21 // IsValid() - Returns true if the underlying numeric value is valid (i.e. has |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 BASE_NUMERIC_ARITHMETIC_OPERATORS(Div, /, /= ) | 260 BASE_NUMERIC_ARITHMETIC_OPERATORS(Div, /, /= ) |
| 261 BASE_NUMERIC_ARITHMETIC_OPERATORS(Mod, %, %= ) | 261 BASE_NUMERIC_ARITHMETIC_OPERATORS(Mod, %, %= ) |
| 262 | 262 |
| 263 #undef BASE_NUMERIC_ARITHMETIC_OPERATORS | 263 #undef BASE_NUMERIC_ARITHMETIC_OPERATORS |
| 264 | 264 |
| 265 } // namespace internal | 265 } // namespace internal |
| 266 | 266 |
| 267 using internal::CheckedNumeric; | 267 using internal::CheckedNumeric; |
| 268 | 268 |
| 269 } // namespace base | 269 } // namespace base |
| 270 } // namespace pdfium |
| 270 | 271 |
| 271 #endif // BASE_SAFE_MATH_H_ | 272 #endif // PDFIUM_THIRD_PARTY_BASE_SAFE_MATH_H_ |
| OLD | NEW |