Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions
safe_math_shared_impl.h File Reference
#include <cassert>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <limits>
#include <type_traits>
#include "ax_build/build_config.h"
#include "base/numerics/safe_conversions.h"

Go to the source code of this file.

Classes

struct  base::internal::CheckedAddFastOp< T, U >
 
struct  base::internal::CheckedSubFastOp< T, U >
 
struct  base::internal::CheckedMulFastOp< T, U >
 
struct  base::internal::ClampedAddFastOp< T, U >
 
struct  base::internal::ClampedSubFastOp< T, U >
 
struct  base::internal::ClampedMulFastOp< T, U >
 
struct  base::internal::ClampedNegFastOp< T >
 
struct  base::internal::UnsignedOrFloatForSize< Numeric, true, false >
 
struct  base::internal::UnsignedOrFloatForSize< Numeric, false, true >
 
struct  base::internal::MathWrapper< M, L, R >
 
struct  base::internal::ResultType< M, L, R >
 
struct  base::internal::ResultType< M, L, R, Args >
 

Namespaces

namespace  base
 
namespace  base::internal
 

Macros

#define BASE_HAS_OPTIMIZED_SAFE_MATH   (0)
 
#define BASE_NUMERIC_ARITHMETIC_VARIADIC(CLASS, CL_ABBR, OP_NAME)
 
#define BASE_NUMERIC_ARITHMETIC_OPERATORS(CLASS, CL_ABBR, OP_NAME, OP, CMP_OP)
 

Functions

template<typename T , typename std::enable_if< std::is_integral< T >::value >::type * = nullptr>
constexpr T base::internal::NegateWrapper (T value)
 
template<typename T , typename std::enable_if< std::is_integral< T >::value >::type * = nullptr>
constexpr std::make_unsigned< T >::type base::internal::InvertWrapper (T value)
 
template<typename T , typename std::enable_if< std::is_integral< T >::value >::type * = nullptr>
constexpr T base::internal::AbsWrapper (T value)
 

Macro Definition Documentation

◆ BASE_HAS_OPTIMIZED_SAFE_MATH

#define BASE_HAS_OPTIMIZED_SAFE_MATH   (0)

Definition at line 32 of file safe_math_shared_impl.h.

◆ BASE_NUMERIC_ARITHMETIC_OPERATORS

#define BASE_NUMERIC_ARITHMETIC_OPERATORS (   CLASS,
  CL_ABBR,
  OP_NAME,
  OP,
  CMP_OP 
)
Value:
/* Binary arithmetic operator for all CLASS##Numeric operations. */ \
template <typename L, typename R, \
typename std::enable_if<Is##CLASS##Op<L, R>::value>::type* = \
nullptr> \
constexpr CLASS##Numeric< \
typename MathWrapper<CLASS##OP_NAME##Op, L, R>::type> \
operator OP(const L lhs, const R rhs) { \
return decltype(lhs OP rhs)::template MathOp<CLASS##OP_NAME##Op>(lhs, \
rhs); \
} \
/* Assignment arithmetic operator implementation from CLASS##Numeric. */ \
template <typename L> \
template <typename R> \
constexpr CLASS##Numeric<L>& CLASS##Numeric<L>::operator CMP_OP( \
const R rhs) { \
return MathOp<CLASS##OP_NAME##Op>(rhs); \
} \
/* Variadic arithmetic functions that return CLASS##Numeric. */ \
BASE_NUMERIC_ARITHMETIC_VARIADIC(CLASS, CL_ABBR, OP_NAME)
#define R(r)

Definition at line 216 of file safe_math_shared_impl.h.

223 { \
224 return decltype(lhs OP rhs)::template MathOp<CLASS##OP_NAME##Op>(lhs, \
225 rhs); \
226 } \
227 /* Assignment arithmetic operator implementation from CLASS##Numeric. */ \
228 template <typename L> \
229 template <typename R> \
230 constexpr CLASS##Numeric<L>& CLASS##Numeric<L>::operator CMP_OP( \
231 const R rhs) { \
232 return MathOp<CLASS##OP_NAME##Op>(rhs); \
233 } \
234 /* Variadic arithmetic functions that return CLASS##Numeric. */ \
235 BASE_NUMERIC_ARITHMETIC_VARIADIC(CLASS, CL_ABBR, OP_NAME)

◆ BASE_NUMERIC_ARITHMETIC_VARIADIC

#define BASE_NUMERIC_ARITHMETIC_VARIADIC (   CLASS,
  CL_ABBR,
  OP_NAME 
)
Value:
template <typename L, typename R, typename... Args> \
constexpr CLASS##Numeric< \
typename ResultType<CLASS##OP_NAME##Op, L, R, Args...>::type> \
CL_ABBR##OP_NAME(const L lhs, const R rhs, const Args... args) { \
return CL_ABBR##MathOp<CLASS##OP_NAME##Op, L, R, Args...>(lhs, rhs, \
args...); \
}
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

Definition at line 207 of file safe_math_shared_impl.h.

211 { \
212 return CL_ABBR##MathOp<CLASS##OP_NAME##Op, L, R, Args...>(lhs, rhs, \
213 args...); \
214 }