#ifndef CORE_FXCRT_NUMERICS_CHECKED_MATH_IMPL_H_
#define CORE_FXCRT_NUMERICS_CHECKED_MATH_IMPL_H_
#include <stddef.h>
#include <stdint.h>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <limits>
#include <type_traits>
#include "core/fxcrt/numerics/safe_conversions.h"
#include "core/fxcrt/numerics/safe_math_shared_impl.h"
namespace pdfium {
namespace internal {
template <typename T>
constexpr bool CheckedAddImpl(T x, T y, T* result) { … }
template <typename T, typename U, class Enable = void>
struct CheckedAddOp { … };
CheckedAddOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type>;
template <typename T>
constexpr bool CheckedSubImpl(T x, T y, T* result) { … }
template <typename T, typename U, class Enable = void>
struct CheckedSubOp { … };
CheckedSubOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type>;
template <typename T>
constexpr bool CheckedMulImpl(T x, T y, T* result) { … }
template <typename T, typename U, class Enable = void>
struct CheckedMulOp { … };
CheckedMulOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type>;
template <typename T, typename U, class Enable = void>
struct CheckedDivOp { … };
CheckedDivOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type>;
template <typename T, typename U, class Enable = void>
struct CheckedModOp { … };
CheckedModOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type>;
template <typename T, typename U, class Enable = void>
struct CheckedLshOp { … };
CheckedLshOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type>;
template <typename T, typename U, class Enable = void>
struct CheckedRshOp { … };
CheckedRshOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type>;
template <typename T, typename U, class Enable = void>
struct CheckedAndOp { … };
CheckedAndOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type>;
template <typename T, typename U, class Enable = void>
struct CheckedOrOp { … };
CheckedOrOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type>;
template <typename T, typename U, class Enable = void>
struct CheckedXorOp { … };
CheckedXorOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type>;
template <typename T, typename U, class Enable = void>
struct CheckedMaxOp { … };
CheckedMaxOp<T, U, typename std::enable_if<std::is_arithmetic<T>::value && std::is_arithmetic<U>::value>::type>;
template <typename T, typename U, class Enable = void>
struct CheckedMinOp { … };
CheckedMinOp<T, U, typename std::enable_if<std::is_arithmetic<T>::value && std::is_arithmetic<U>::value>::type>;
#define BASE_FLOAT_ARITHMETIC_OPS …
BASE_FLOAT_ARITHMETIC_OPS
BASE_FLOAT_ARITHMETIC_OPS
BASE_FLOAT_ARITHMETIC_OPS
BASE_FLOAT_ARITHMETIC_OPS
#undef BASE_FLOAT_ARITHMETIC_OPS
enum NumericRepresentation { … };
template <typename NumericType>
struct GetNumericRepresentation { … };
template <typename T,
NumericRepresentation type = GetNumericRepresentation<T>::value>
class CheckedNumericState { … };
CheckedNumericState<T, NUMERIC_INTEGER>;
CheckedNumericState<T, NUMERIC_FLOATING>;
}
}
#endif