#ifndef BASE_NUMERICS_CHECKED_MATH_IMPL_H_
#define BASE_NUMERICS_CHECKED_MATH_IMPL_H_
#include <stdint.h>
#include <cmath>
#include <concepts>
#include <limits>
#include <type_traits>
#include "base/numerics/safe_conversions.h"
#include "base/numerics/safe_math_shared_impl.h"
namespace base {
namespace internal {
template <typename T>
constexpr bool CheckedAddImpl(T x, T y, T* result) { … }
template <typename T, typename U>
struct CheckedAddOp { … };
CheckedAddOp<T, U>;
template <typename T>
constexpr bool CheckedSubImpl(T x, T y, T* result) { … }
template <typename T, typename U>
struct CheckedSubOp { … };
CheckedSubOp<T, U>;
template <typename T>
constexpr bool CheckedMulImpl(T x, T y, T* result) { … }
template <typename T, typename U>
struct CheckedMulOp { … };
CheckedMulOp<T, U>;
template <typename T, typename U>
struct CheckedDivOp { … };
CheckedDivOp<T, U>;
template <typename T, typename U>
struct CheckedModOp { … };
CheckedModOp<T, U>;
template <typename T, typename U>
struct CheckedLshOp { … };
CheckedLshOp<T, U>;
template <typename T, typename U>
struct CheckedRshOp { … };
CheckedRshOp<T, U>;
template <typename T, typename U>
struct CheckedAndOp { … };
CheckedAndOp<T, U>;
template <typename T, typename U>
struct CheckedOrOp { … };
CheckedOrOp<T, U>;
template <typename T, typename U>
struct CheckedXorOp { … };
CheckedXorOp<T, U>;
template <typename T, typename U>
struct CheckedMaxOp { … };
CheckedMaxOp<T, U>;
template <typename T, typename U>
struct CheckedMinOp { … };
CheckedMinOp<T, U>;
#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